Structure

Examined “global” ancestry for all available samples. Old replicates and some suspected contamination/switching have been removed. The masterpopmap has ALL of these samples.

Admixture model, LD=0, allele freqs are uncorrelated, alpha is inferred for each popualtion.

sfiles <- list.files(path="~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/Results/", 
  pattern=glob2rx("outfile_*f"),full.names=TRUE)

slist <- readQ(sfiles,filetype="structure", 
               indlabfromfile = TRUE, 
               readci = TRUE)

popmap <- left_join(data.frame(sampID = rownames(slist[[1]])), 
                    masterpopmap)
## Joining, by = "sampID"
## Warning: Column `sampID` joining factor and character vector, coercing into
## character vector
popID <- data.frame(popID = popmap$popID)
popID <- data.frame(lapply(popID, as.character), stringsAsFactors=FALSE)
# sapply(popID, is.character)

pop_order <- sample_meta.dat[,c("popID", "Order")]
pop_order <- arrange(pop_order, Order)[,1]
pop_order
##  [1] "46CH"       "1WY"        "34UT"       "2CO"        "4CO"       
##  [6] "5CO"        "11CO"       "32UT"       "31NV"       "33NV"      
## [11] "12AZ"       "CARINA_LAB" "SUB_LAB"    "44GR"       "43GR"      
## [16] "39CR"       "38CR"       "37CR"       "40CR"       "41CR"      
## [21] "42CR"       "6KS"        "8OK"        "28NM"       "26NM"      
## [26] "27NM"       "15TX"       "19TX"       "21NM"       "16TX"      
## [31] "20NM"       "18TX"       "52TX"       "50TX"       "51TX"      
## [36] "47TX"       "49TX"
samplesize <- left_join(popmap, sample_meta.dat) %>%
  count(popID) %>%
  merge(sample_meta.dat)
## Joining, by = "popID"
write.table(samplesize, "pop_metadata_samplesize.tsv", sep = "\t", row.names = F, quote = F)

What is the best K?

sr1 <- summariseQ(tabulateQ(slist))
p <- evannoMethodStructure(data=sr1,exportplot=F,returnplot=T,returndata=F,basesize=12,linesize=0.7)
grid.arrange(p)

evannoMethodStructure(data=sr1,
                  exportplot=T,
                  exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/",
                outputfilename = "global_deltaK",
                returndata=F,
                height = 10, width = 9)

K=2 and K=3 are super stable. D. carinata appears as a mix between sublineata and elongata. I am surprised to see, for the first time in these samples, indications of admixture between carinlata and sublineata along the Rio Grande.

k2 <- plotQ(alignK(slist[c(21:30)]),
            imgoutput="join",
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            clustercol=cbbPalette,
            subsetgrp = pop_order,
            ordergrp = T,
            grplab = popID,
            linepos = 1,
            grplabangle=-45,
            grplabpos = 0, 
            grplabheight=20)
grid.arrange(k2$plot[[1]])

k3 <- plotQ(alignK(slist[c(31:40)]),
            imgoutput="join",
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            clustercol=cbbPalette,
            ordergrp = T,
            grplab = popID,
            grplabangle=-90)
grid.arrange(k3$plot[[1]])

As usual, K=4 reflects lab populations, elongata in the native range, and hints at carinulata substructure.

k4 <- plotQ(alignK(slist[c(41:50)]),
            imgoutput="join",
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            clustercol=cbbPalette,
            grplab = popID,
            ordergrp = T,
            grplabangle=-90)
grid.arrange(k4$plot[[1]])

k5 <- plotQ(alignK(slist[c(51:60)]),
            imgoutput="join",
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            clustercol=cbbPalette,
            grplab = popID,
            ordergrp = T,
            grplabangle=-90)
grid.arrange(k5$plot[[1]])

k6 <- plotQ(alignK(slist[c(61:70)]),
            imgoutput="join",
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            clustercol=cbbPalette,
            grplab = popID,
            ordergrp = T,
            grplabangle=-90)
grid.arrange(k6$plot[[1]])

k7 <- plotQ(alignK(slist[c(71:80)]),
            imgoutput="join",
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            clustercol=cbbPalette,
            grplab = popID,
            grplabangle=-90)
grid.arrange(k7$plot[[1]])

k8 <- plotQ(alignK(slist[c(81:90)]),
            imgoutput="join",
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            # clustercol=cbbPalette,
            grplab = popID,
            grplabangle=-90)
grid.arrange(k8$plot[[1]])

plotQMultiline(slist[41],
      showticks=T,
      clustercol=cbbPalette,
      grplab = popID,
      ordergrp=TRUE,
      spl = 25,
      showindlab = T,
      showyaxis = T,
      barsize = .9,
      subsetgrp = pop_order,
      basesize=11, 
      exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/",
      outputfilename = "multilineK4",
      useindlab = T)
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/multilineK4-1.png exported.
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/multilineK4-2.png exported.
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/multilineK4-3.png exported.
plotQ(alignK(slist[c(21:30)]),
            imgoutput="join",
                  exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/",
  outputfilename =  "Joined-K2",  
  exportplot=T,
  showyaxis=T,
  showsp = F,
  clustercol=cbbPalette,
  subsetgrp = pop_order,
  height = .1,
  ordergrp = T,
  grplab = popID,
  linepos = 1,
  divtype = 1,
  grplabangle=45,
  grplabpos = .8,
  grplabspacer = 0,
  grplabheight=70,
  width=100,
  showtitle=T,
  grplabsize = 4,
  titlelab="Global Population Structure, K=2",
  titlesize = 20)
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/Joined-K2.png exported.
plotQ(alignK(slist[c(31:40)]),
            imgoutput="join",
                  exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/",
  outputfilename =  "Joined-K3",    
  exportplot=T,
  showyaxis=T,
  showsp = F,
  clustercol=cbbPalette,
  subsetgrp = pop_order,
  height = .1,
  ordergrp = T,
  grplab = popID,
  linepos = 1,
  divtype = 1,
  grplabangle=45,
  grplabpos = .8,
  grplabspacer = 0,
  grplabheight=70,
  width=100,
  showtitle=T,
  grplabsize = 4,
  titlelab="Global Population Structure, K=3",
  titlesize = 20)
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/Joined-K3.png exported.
plotQ(alignK(slist[c(41:50)]),
            imgoutput="join",
            exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/",
  outputfilename =  "Joined-K4",  
  exportplot=T,
  showyaxis=T,
  showsp = F,
  clustercol=cbbPalette,
  subsetgrp = pop_order,
  height = .1,
  ordergrp = T,
  grplab = popID,
  linepos = 1,
  divtype = 1,
  grplabangle=45,
  grplabpos = .8,
  grplabspacer = 0,
  grplabheight=70,
  width=100,
  showtitle=T,
  grplabsize = 4,
  titlelab="Global Population Structure, K=4",
  titlesize = 20)
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/Joined-K4.png exported.
plotQ(alignK(slist[c(51:60)]),
            imgoutput="join",
            exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/",
  outputfilename =  "Joined-K5",  
  exportplot=T,
  showyaxis=T,
  showsp = F,
  clustercol=cbbPalette,
  subsetgrp = pop_order,
  height = .1,
  ordergrp = T,
  grplab = popID,
  linepos = 1,
  divtype = 1,
  grplabangle=45,
  grplabpos = .8,
  grplabspacer = 0,
  grplabheight=70,
  width=100,
  showtitle=T,
  grplabsize = 4,
  titlelab="Global Population Structure, K=5",
  titlesize = 20)
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/Joined-K5.png exported.
plotQ(alignK(slist[c(61:70)]),
            imgoutput="join",
            exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/",
  outputfilename =  "Joined-K6",  
  exportplot=T,
  showyaxis=T,
  showsp = F,
  clustercol=cbbPalette,
  subsetgrp = pop_order,
  height = .1,
  ordergrp = T,
  grplab = popID,
  linepos = 1,
  divtype = 1,
  grplabangle=45,
  grplabpos = .8,
  grplabspacer = 0,
  grplabheight=70,
  width=100,
  showtitle=T,
  grplabsize = 4,
  titlelab="Global Population Structure, K=6",
  titlesize = 20)
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/Joined-K6.png exported.
plotQ(alignK(slist[c(71:80)]),
            imgoutput="join",
            exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/",
  outputfilename =  "Joined-K7",  
  exportplot=T,
  showyaxis=T,
  showsp = F,
  clustercol=cbbPalette,
  subsetgrp = pop_order,
  height = .1,
  ordergrp = T,
  grplab = popID,
  linepos = 1,
  divtype = 1,
  grplabangle=45,
  grplabpos = .8,
  grplabspacer = 0,
  grplabheight=70,
  width=100,
  showtitle=T,
  grplabsize = 4,
  titlelab="Global Population Structure, K=7",
  titlesize = 20)
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/Joined-K7.png exported.
## extract one q file that reflects known species identity
global_k4_q <- slist[[41]]
global_k4_q$sampID <- row.names(global_k4_q)

## which cluster is carinulata?
gr_samples <- masterpopmap[grep( "CR", masterpopmap[,2]), ]
gr_q <- semi_join(global_k4_q, gr_samples)
max_cl_gr <- sapply(gr_q[,1:4], max)
elongata_cluster <- which(colnames(gr_q) == colnames(gr_q[which(max_cl_gr==1)]))
elongata_cluster
## [1] 1
## which cluster is elongata?
ch_samples <- masterpopmap[grep( "CH", masterpopmap[,2]), ]
ch_q <- semi_join(global_k4_q, ch_samples)
max_cl_ch <- sapply(ch_q[,1:4], max)
carinulata_cluster <- which(colnames(ch_q) == colnames(ch_q[which(max_cl_ch==1)]))
carinulata_cluster
## [1] 3
## which cluster is sublineata?
sub_samples <- masterpopmap[grep( "SUB_LAB", masterpopmap[,2]), ]
sub_q <- semi_join(global_k4_q, sub_samples)
max_cl_sub <- sapply(sub_q[,1:4], max)
sublineata_cluster <- which(colnames(sub_q) == colnames(sub_q[which(max_cl_sub==1)]))

## which cluster is carinata?
carina_samples <- masterpopmap[grep( "CARINA_LAB", masterpopmap[,2]),]
carina_q <- semi_join(global_k4_q, carina_samples)
max_cl_cara <- sapply(carina_q[,1:4], max)
carinata_cluster <- which(colnames(carina_q) == colnames(carina_q[which(max_cl_cara==1)]))

cls <- c(carinata_cluster, carinulata_cluster, sublineata_cluster, elongata_cluster)
spp <- c("carinata", "carinulata", "sublineata", "elongata")
clusters <- as.data.frame(cbind(spp = spp[order(cls)], cluster = seq(1,4)))


colnames(global_k4_q)[1:4] <- as.character(clusters$spp)
q_popmap <- merge(global_k4_q, popmap)
head(q_popmap)
##    sampID elongata carinata carinulata sublineata popID
## 1      D1    1.000        0      0.000      0.000  38CR
## 2     D12    1.000        0      0.000      0.000  41CR
## 3     D13    1.000        0      0.000      0.000  41CR
## 4 D15_rep    0.936        0      0.058      0.006  41CR
## 5     D16    1.000        0      0.000      0.000  41CR
## 6     D17    1.000        0      0.000      0.000  43GR
## slist[43]
## 1 = elongata
## 2 = carinata
## 3 = sub
## 4 = carinu
legend <- merge(legend_colors, clusters)
clustercols <- arrange(legend, cluster) %>%
  select(cbbPalette)
clustercols <- clustercols$cbbPalette

legendlab <- arrange(legend, cluster) %>%
  mutate(label = paste("D. ", spp))
legendlab <- legendlab$label[1:4]

plotQ(slist[41],
            exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/",
        outputfilename =  "MainTextFigure_K4",  
  exportplot=T,
  showyaxis=T,
  showsp = F,
  clustercol=clustercols,
  subsetgrp = pop_order,
  ordergrp = T,
  grplab = popID,
  linepos = 1,
  linesize=0.8,
  pointsize = 5,
  divtype = 1,
  grplabangle= 90,
  grplabpos = .9,
  grplabspacer = 0,
  grplabheight=35,
  grplabsize = 10,
  height = .05,
  width=100,
  showlegend = T, legendkeysize=30,legendtextsize=30, legendpos="left", legendlab=legendlab,
  # titlelab="Global Population Structure K=4",
  # titlesize = 20,
  basesize=30)
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/MainTextFigure_K4.png exported.
# custom strip panel label showing k only
fn1 <- function(x) attr(x,"k")
spnames <- paste0("K=",sapply(slist,fn1))


# Combine K=2, K=3, K=4
k2k3k4 <- c(21,31,41)
plotQ(slist[k2k3k4],
            imgoutput="join",
            exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/",
  outputfilename =  "Joined-K2-K3-K4",  
  exportplot=T,
  showyaxis=T,
  splab=spnames[k2k3k4],
  splabsize= 20,
  clustercol=clustercols,
  subsetgrp = pop_order,
  height = .1,
  ordergrp = T,
  grplab = popID,
  linepos = 1,
  divtype = 1,
  grplabangle= 90,
  grplabpos = .8,
  grplabspacer = 0,
  grplabheight=70,
  width=100,
  showtitle=T,
  grplabsize = 8,
  # showlegend = T,
  # legendkeysize=20,legendtextsize=20, legendpos="right", legendlab=legendlab,
  titlelab="Global Population Structure across K",
  titlesize = 20)
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/Joined-K2-K3-K4.png exported.
## Plot subsets of the whole set
subset1 <- sample_meta.dat %>% 
  arrange(Order) %>%
  select(popID) %>%
  slice(1:20)

subset2 <- sample_meta.dat %>% 
  arrange(Order) %>%
  select(popID) %>%
  slice(21:nrow(sample_meta.dat))

plotQ(slist[41],
            exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/",
        outputfilename =  "subset1_global",  
  exportplot=T,
  showyaxis=T,
  showsp = F,
  clustercol=clustercols,
  subsetgrp=as.character(subset1$popID),
  ordergrp = T,
  grplab = popID,
  linepos = .98,
  linesize=0.8,
  pointsize = 5,
  divtype = 1,
  grplabangle= 90,
  grplabpos = .9,
  grplabspacer = 0,
  grplabheight=55,
  grplabsize = 20,
  height = .05,
  width=100,
  showlegend = T, legendkeysize=30,legendtextsize=30, legendpos="left", legendlab=legendlab,
  basesize=30)
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/subset1_global.png exported.
plotQ(slist[41],
            exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/",
        outputfilename =  "subset2_global",  
  exportplot=T,
  showyaxis=T,
  showsp = F,
  clustercol=clustercols,
  subsetgrp=as.character(subset2$popID),
  ordergrp = T,
  grplab = popID,
  linepos = 1,
  linesize=0.8,
  pointsize = 5,
  divtype = 1,
  grplabangle= 90,
  grplabpos = .9,
  grplabspacer = 0,
  grplabheight=45,
  grplabsize =  20,
  height = .05,
  width=100,
  basesize=30)
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/structure_analysis/plots/subset2_global.png exported.
## subset individuals for substructure of elongata 
elongata <- filter(global_k4_q, elongata > .1) %>%
  select('sampID')
nrow(elongata)
## [1] 98
elongata_popmap <- semi_join(popmap, elongata)
## Joining, by = "sampID"
write.table(elongata_popmap,
  file = "../info/elongata_popmap.tsv", 
            sep = "\t",
            quote=F, col.names = F, row.names = F)

## subset individuals for substructure of elongata 
carinulata <- filter(global_k4_q, carinulata > .1) %>%
  select('sampID')
nrow(carinulata)
## [1] 182
carinulata_popmap <- semi_join(popmap, carinulata)
## Joining, by = "sampID"
write.table(carinulata_popmap,
  file = "../info/carinulata_popmap.tsv", 
            sep = "\t",
            quote=F, col.names = F, row.names = F)

## Are population genetic statistics (like private alleles etc) to populations filtering?
others_popmap <- anti_join(popmap, carinulata)
## Joining, by = "sampID"
write.table(others_popmap,
  file = "../info/others_popmap.tsv", 
            sep = "\t",
            quote=F, col.names = F, row.names = F)

Which sites have individuals with admxiture?

sample_size <- samplesize %>%
  select('popID', 'n')

num_admixed_inds <- q_popmap %>%
  filter_at(vars(elongata:sublineata),
            ~ . < .95) %>%
  group_by(popID) %>%
  count(popID)
colnames(num_admixed_inds)[2] <- 'num_admixed'

num_admixed_inds
## # A tibble: 14 x 2
## # Groups:   popID [14]
##    popID num_admixed
##    <chr>       <int>
##  1 15TX            4
##  2 16TX            1
##  3 18TX            2
##  4 19TX            4
##  5 20NM            5
##  6 21NM            4
##  7 26NM           13
##  8 27NM            4
##  9 28NM            8
## 10 37CR            1
## 11 41CR            1
## 12 44GR            1
## 13 47TX            1
## 14 6KS             1
merge(sample_size, num_admixed_inds) %>%
  mutate(perc_admixed = num_admixed/n) %>%
  arrange(desc(perc_admixed))
##    popID  n num_admixed perc_admixed
## 1   26NM 18          13   0.72222222
## 2   28NM 17           8   0.47058824
## 3   20NM 17           5   0.29411765
## 4   21NM 14           4   0.28571429
## 5   19TX 15           4   0.26666667
## 6   15TX 16           4   0.25000000
## 7   27NM 20           4   0.20000000
## 8   37CR  6           1   0.16666667
## 9   18TX 17           2   0.11764706
## 10   6KS 10           1   0.10000000
## 11  41CR 16           1   0.06250000
## 12  44GR 16           1   0.06250000
## 13  16TX 18           1   0.05555556
## 14  47TX 25           1   0.04000000
q_popmap %>%
  filter_at(vars(elongata:sublineata),
            ~ . < .95) %>%
  group_by(popID) %>%
  summarize_at(vars(carinata:sublineata), funs(mean, var))
## Warning: funs() is soft deprecated as of dplyr 0.8.0
## Please use a list of either functions or lambdas: 
## 
##   # Simple named list: 
##   list(mean = mean, median = median)
## 
##   # Auto named with `tibble::lst()`: 
##   tibble::lst(mean, median)
## 
##   # Using lambdas
##   list(~ mean(., trim = .2), ~ median(., na.rm = TRUE))
## This warning is displayed once per session.
## # A tibble: 14 x 7
##    popID carinata_mean carinulata_mean sublineata_mean carinata_var
##    <chr>         <dbl>           <dbl>           <dbl>        <dbl>
##  1 15TX         0.821         0                 0.0452      0.00391
##  2 16TX         0.875         0                 0.125      NA      
##  3 18TX         0.332         0.0455            0.622       0.218  
##  4 19TX         0.901         0.0248            0.0742      0.00178
##  5 20NM         0.225         0                 0.757       0.0559 
##  6 21NM         0.0792        0.00025           0.854       0.0150 
##  7 26NM         0.171         0.000308          0.809       0.0171 
##  8 27NM         0.143         0                 0.846       0.0214 
##  9 28NM         0.382         0.201             0.415       0.0546 
## 10 37CR         0             0.114             0          NA      
## 11 41CR         0             0.058             0.006      NA      
## 12 44GR         0             0.058             0          NA      
## 13 47TX         0             0.094             0.905      NA      
## 14 6KS          0             0.091             0.909      NA      
## # … with 2 more variables: carinulata_var <dbl>, sublineata_var <dbl>

Which sites have multiple spp, even without admixture?

foo <- q_popmap %>%
  filter_all(any_vars(. > .95)) %>%
  group_by(popID) %>%
  summarize_at(vars(elongata:sublineata), funs(sum)) %>%
  merge(sample_size) 

max_ancestry <-  apply(X=foo[,2:5], MARGIN=1, FUN=max)
### if a cluster has less than foo$sample_size-.5, will return any pop with an ind less than 50% of majority ancestry 
mixed_pops <- foo[foo$n - .5 > max_ancestry,]
mixed_pops
##    popID elongata carinata carinulata sublineata  n
## 3   15TX    1.538   14.265      0.004      0.187 16
## 4   16TX   16.992    0.875      0.001      0.131 18
## 5   18TX    0.000    0.664      2.143     14.191 17
## 6   19TX    0.001   14.484      0.130      0.384 15
## 8   20NM    0.090    1.138      0.004     15.768 17
## 9   21NM    0.273    0.337      0.008     13.381 14
## 10  26NM    0.285    2.221      0.004     15.486 18
## 11  27NM    0.222    0.604      0.001     19.172 20
## 12  28NM    0.019    5.045      8.597      3.339 17
## 32   6KS    0.000    7.964      1.091      0.945 10
perc_admixed <- merge(sample_size, num_admixed_inds) %>%
  mutate(perc_admixed = num_admixed/n) %>%
  arrange(desc(perc_admixed))
perc_admixed
##    popID  n num_admixed perc_admixed
## 1   26NM 18          13   0.72222222
## 2   28NM 17           8   0.47058824
## 3   20NM 17           5   0.29411765
## 4   21NM 14           4   0.28571429
## 5   19TX 15           4   0.26666667
## 6   15TX 16           4   0.25000000
## 7   27NM 20           4   0.20000000
## 8   37CR  6           1   0.16666667
## 9   18TX 17           2   0.11764706
## 10   6KS 10           1   0.10000000
## 11  41CR 16           1   0.06250000
## 12  44GR 16           1   0.06250000
## 13  16TX 18           1   0.05555556
## 14  47TX 25           1   0.04000000
mix_admix <- full_join(mixed_pops, perc_admixed[,c('popID', 'perc_admixed')]) %>%
  arrange(desc(perc_admixed)) 
## Joining, by = "popID"
mix_admix
##    popID elongata carinata carinulata sublineata  n perc_admixed
## 1   26NM    0.285    2.221      0.004     15.486 18   0.72222222
## 2   28NM    0.019    5.045      8.597      3.339 17   0.47058824
## 3   20NM    0.090    1.138      0.004     15.768 17   0.29411765
## 4   21NM    0.273    0.337      0.008     13.381 14   0.28571429
## 5   19TX    0.001   14.484      0.130      0.384 15   0.26666667
## 6   15TX    1.538   14.265      0.004      0.187 16   0.25000000
## 7   27NM    0.222    0.604      0.001     19.172 20   0.20000000
## 8   37CR       NA       NA         NA         NA NA   0.16666667
## 9   18TX    0.000    0.664      2.143     14.191 17   0.11764706
## 10   6KS    0.000    7.964      1.091      0.945 10   0.10000000
## 11  41CR       NA       NA         NA         NA NA   0.06250000
## 12  44GR       NA       NA         NA         NA NA   0.06250000
## 13  16TX   16.992    0.875      0.001      0.131 18   0.05555556
## 14  47TX       NA       NA         NA         NA NA   0.04000000

There may be almost no population that is completely pure. How many ‘pure’ sites did we detect?

setdiff(popmap$popID, mix_admix$popID )
##  [1] "11CO"       "12AZ"       "1WY"        "2CO"        "31NV"      
##  [6] "32UT"       "33NV"       "34UT"       "38CR"       "39CR"      
## [11] "43GR"       "46CH"       "49TX"       "4CO"        "50TX"      
## [16] "51TX"       "52TX"       "5CO"        "8OK"        "CARINA_LAB"
## [21] "SUB_LAB"

Among individuals, how many pure? How many hybrids, and of what type?

ci <- data.frame(attributes(slist[[41]])$ci)
colnames(ci) <- paste0(rep(colnames(global_k4_q)[1:4], each=2),
       "_", rep(c("L", "H"), times = 4))
ci <- cbind(ci, global_k4_q)
ci <- merge(ci, masterpopmap)
ci
##       sampID elongata_L elongata_H carinata_L carinata_H carinulata_L
## 1         D1      0.999      1.000      0.000      0.001        0.000
## 2        D12      0.998      1.000      0.000      0.001        0.000
## 3        D13      0.999      1.000      0.000      0.001        0.000
## 4    D15_rep      0.914      0.956      0.000      0.001        0.039
## 5        D16      0.999      1.000      0.000      0.001        0.000
## 6        D17      0.998      1.000      0.000      0.001        0.000
## 7        D18      0.998      1.000      0.000      0.001        0.000
## 8        D19      0.998      1.000      0.000      0.001        0.000
## 9         D2      0.999      1.000      0.000      0.001        0.000
## 10       D20      0.998      1.000      0.000      0.001        0.000
## 11       D21      0.997      1.000      0.000      0.001        0.000
## 12       D22      0.998      1.000      0.000      0.001        0.000
## 13       D23      0.998      1.000      0.000      0.001        0.000
## 14   D24_rep      0.921      0.962      0.000      0.001        0.038
## 15       D27      0.998      1.000      0.000      0.001        0.000
## 16        D3      0.998      1.000      0.000      0.001        0.000
## 17       D33      0.998      1.000      0.000      0.001        0.000
## 18       D34      0.999      1.000      0.000      0.001        0.000
## 19       D35      0.997      1.000      0.000      0.001        0.000
## 20       D37      0.999      1.000      0.000      0.001        0.000
## 21       D38      0.998      1.000      0.000      0.001        0.000
## 22       D39      0.998      1.000      0.000      0.001        0.000
## 23        D4      0.999      1.000      0.000      0.001        0.000
## 24       D40      0.998      1.000      0.000      0.001        0.000
## 25       D41      0.998      1.000      0.000      0.001        0.000
## 26       D42      0.998      1.000      0.000      0.001        0.000
## 27       D43      0.998      1.000      0.000      0.001        0.000
## 28       D44      0.998      1.000      0.000      0.001        0.000
## 29       D46      0.999      1.000      0.000      0.001        0.000
## 30       D47      0.999      1.000      0.000      0.001        0.000
## 31       D48      0.999      1.000      0.000      0.001        0.000
## 32       D49      0.998      1.000      0.000      0.001        0.000
## 33        D5      0.999      1.000      0.000      0.001        0.000
## 34       D50      0.998      1.000      0.000      0.001        0.000
## 35       D51      0.998      1.000      0.000      0.001        0.000
## 36       D52      0.999      1.000      0.000      0.001        0.000
## 37       D53      0.998      1.000      0.000      0.001        0.000
## 38       D54      0.998      1.000      0.000      0.001        0.000
## 39       D55      0.999      1.000      0.000      0.001        0.000
## 40       D56      0.999      1.000      0.000      0.001        0.000
## 41       D57      0.999      1.000      0.000      0.001        0.000
## 42       D58      0.998      1.000      0.000      0.001        0.000
## 43       D59      0.999      1.000      0.000      0.001        0.000
## 44        D6      0.999      1.000      0.000      0.001        0.000
## 45       D60      0.998      1.000      0.000      0.001        0.000
## 46       D61      0.999      1.000      0.000      0.001        0.000
## 47       D62      0.998      1.000      0.000      0.001        0.000
## 48       D63      0.997      1.000      0.000      0.001        0.000
## 49       D64      0.998      1.000      0.000      0.001        0.000
## 50   D65_rep      0.985      1.000      0.000      0.001        0.000
## 51        D7      0.999      1.000      0.000      0.001        0.000
## 52   D70_rep      0.860      0.909      0.000      0.001        0.090
## 53   D71_rep      0.991      1.000      0.000      0.001        0.000
## 54       D72      0.997      1.000      0.000      0.001        0.000
## 55       D73      0.998      1.000      0.000      0.001        0.000
## 56       D75      0.998      1.000      0.000      0.001        0.000
## 57       D76      0.998      1.000      0.000      0.001        0.000
## 58       D77      0.998      1.000      0.000      0.001        0.000
## 59       D78      0.999      1.000      0.000      0.001        0.000
## 60       D79      0.999      1.000      0.000      0.001        0.000
## 61        D8      0.999      1.000      0.000      0.001        0.000
## 62       D80      0.999      1.000      0.000      0.001        0.000
## 63       D81      0.999      1.000      0.000      0.001        0.000
## 64       D82      0.998      1.000      0.000      0.001        0.000
## 65       D83      0.999      1.000      0.000      0.001        0.000
## 66       D84      0.998      1.000      0.000      0.001        0.000
## 67       D85      0.998      1.000      0.000      0.001        0.000
## 68       D86      0.998      1.000      0.000      0.001        0.000
## 69       D87      0.997      1.000      0.000      0.001        0.000
## 70       D88      0.998      1.000      0.000      0.001        0.000
## 71       D89      0.997      1.000      0.000      0.001        0.000
## 72       D90      0.997      1.000      0.000      0.001        0.000
## 73       D91      0.998      1.000      0.000      0.001        0.000
## 74       D92      0.997      1.000      0.000      0.001        0.000
## 75       D93      0.997      1.000      0.000      0.001        0.000
## 76       D94      0.997      1.000      0.000      0.001        0.000
## 77        E1      0.000      0.001      0.000      0.001        0.999
## 78       E10      0.000      0.001      0.000      0.001        0.999
## 79       E11      0.000      0.001      0.000      0.001        0.999
## 80       E12      0.000      0.001      0.000      0.001        0.999
## 81       E13      0.000      0.001      0.000      0.001        0.999
## 82   E15_rep      0.000      0.001      0.000      0.001        0.999
## 83       E17      0.000      0.001      0.000      0.001        0.999
## 84       E18      0.000      0.001      0.000      0.001        0.999
## 85       E19      0.000      0.001      0.000      0.001        0.999
## 86       E20      0.000      0.001      0.000      0.001        0.999
## 87       E21      0.000      0.001      0.000      0.001        0.999
## 88       E22      0.000      0.001      0.000      0.001        0.999
## 89       E23      0.000      0.001      0.000      0.001        0.999
## 90   E24_rep      0.000      0.001      0.000      0.001        0.998
## 91       E25      0.000      0.001      0.000      0.001        0.999
## 92       E26      0.000      0.001      0.000      0.001        0.999
## 93       E27      0.000      0.001      0.000      0.001        0.999
## 94       E28      0.000      0.001      0.000      0.001        0.999
## 95       E29      0.205      0.291      0.709      0.794        0.000
## 96        E3      0.000      0.001      0.000      0.001        0.999
## 97       E30      0.000      0.001      0.990      1.000        0.000
## 98       E31      0.000      0.001      0.000      0.001        0.999
## 99       E32      0.000      0.001      0.000      0.001        0.999
## 100      E33      0.000      0.001      0.000      0.001        0.999
## 101      E34      0.000      0.001      0.000      0.001        0.999
## 102      E35      0.000      0.001      0.000      0.001        0.999
## 103      E36      0.000      0.001      0.000      0.001        0.999
## 104      E37      0.000      0.001      0.000      0.001        0.999
## 105      E38      0.000      0.001      0.000      0.001        0.999
## 106      E39      0.000      0.001      0.000      0.001        0.999
## 107       E4      0.000      0.001      0.000      0.001        0.999
## 108      E40      0.000      0.001      0.000      0.001        0.999
## 109      E41      0.000      0.001      0.000      0.001        0.999
## 110      E42      0.000      0.001      0.000      0.001        0.999
## 111      E43      0.000      0.001      0.000      0.001        0.999
## 112      E44      0.000      0.001      0.000      0.001        0.999
## 113      E45      0.000      0.001      0.000      0.001        0.999
## 114      E46      0.000      0.001      0.000      0.001        0.999
## 115      E47      0.000      0.001      0.000      0.001        0.999
## 116      E48      0.000      0.001      0.000      0.001        0.999
## 117      E49      0.000      0.001      0.000      0.001        0.999
## 118       E5      0.000      0.001      0.000      0.001        0.999
## 119      E50      0.000      0.001      0.000      0.001        0.999
## 120      E51      0.000      0.001      0.000      0.001        0.999
## 121      E52      0.000      0.001      0.000      0.001        0.999
## 122      E53      0.000      0.001      0.000      0.001        0.999
## 123      E54      0.000      0.001      0.000      0.001        0.999
## 124      E55      0.000      0.001      0.000      0.001        0.999
## 125      E56      0.000      0.001      0.000      0.001        0.999
## 126      E57      0.000      0.001      0.000      0.001        0.999
## 127      E58      0.000      0.001      0.000      0.001        0.999
## 128      E59      0.000      0.001      0.000      0.001        0.999
## 129      E60      0.000      0.001      0.000      0.001        0.999
## 130      E61      0.000      0.001      0.000      0.001        0.999
## 131      E62      0.000      0.001      0.000      0.001        0.999
## 132      E63      0.000      0.001      0.000      0.001        0.999
## 133      E64      0.000      0.001      0.000      0.001        0.999
## 134      E65      0.000      0.001      0.000      0.001        0.998
## 135      E67      0.000      0.001      0.000      0.001        0.999
## 136      E68      0.000      0.001      0.000      0.001        0.999
## 137      E69      0.000      0.001      0.000      0.001        0.999
## 138       E7      0.000      0.001      0.000      0.001        0.999
## 139      E70      0.000      0.001      0.000      0.001        0.998
## 140      E75      0.000      0.001      0.000      0.001        0.999
## 141      E76      0.000      0.001      0.000      0.001        0.999
## 142      E77      0.000      0.001      0.000      0.001        0.999
## 143      E78      0.000      0.001      0.000      0.001        0.999
## 144       E8      0.000      0.001      0.000      0.001        0.999
## 145      E82      0.000      0.001      0.000      0.001        0.999
## 146      E84      0.000      0.001      0.000      0.001        0.999
## 147      E85      0.000      0.001      0.000      0.001        0.999
## 148      E86      0.000      0.001      0.000      0.001        0.999
## 149      E87      0.000      0.001      0.000      0.001        0.999
## 150       E9      0.000      0.001      0.000      0.001        0.999
## 151      E90      0.000      0.001      0.000      0.001        0.999
## 152      E92      0.000      0.001      0.000      0.001        0.999
## 153      E94      0.000      0.001      0.000      0.001        0.999
## 154      E95      0.000      0.001      0.000      0.001        0.998
## 155       F1      0.000      0.001      0.000      0.001        0.999
## 156      F10      0.000      0.001      0.000      0.001        0.999
## 157      F11      0.000      0.001      0.000      0.001        0.998
## 158      F12      0.000      0.001      0.000      0.001        0.999
## 159      F13      0.000      0.001      0.000      0.001        0.999
## 160      F14      0.000      0.001      0.000      0.001        0.999
## 161      F15      0.000      0.001      0.000      0.001        0.999
## 162      F16      0.000      0.001      0.000      0.001        0.999
## 163      F17      0.000      0.001      0.000      0.001        0.999
## 164      F18      0.000      0.001      0.000      0.001        0.999
## 165      F19      0.000      0.001      0.000      0.006        0.991
## 166       F2      0.000      0.001      0.000      0.001        0.999
## 167      F20      0.000      0.001      0.000      0.001        0.999
## 168      F21      0.000      0.001      0.000      0.001        0.995
## 169      F22      0.000      0.001      0.000      0.001        0.999
## 170      F23      0.000      0.001      0.000      0.001        0.999
## 171      F24      0.000      0.001      0.000      0.001        0.999
## 172      F25      0.000      0.001      0.000      0.001        0.999
## 173      F26      0.000      0.001      0.000      0.001        0.999
## 174      F27      0.000      0.001      0.000      0.001        0.999
## 175      F28      0.000      0.001      0.000      0.001        0.999
## 176      F29      0.000      0.001      0.997      1.000        0.000
## 177      F30      0.000      0.001      0.997      1.000        0.000
## 178      F33      0.000      0.001      0.943      1.000        0.000
## 179      F34      0.000      0.001      0.997      1.000        0.000
## 180      F35      0.000      0.001      0.998      1.000        0.000
## 181      F36      0.000      0.001      0.997      1.000        0.000
## 182      F37      0.000      0.001      0.000      0.001        0.999
## 183      F38      0.000      0.001      0.000      0.001        0.999
## 184      F39      0.000      0.001      0.000      0.001        0.999
## 185       F4      0.000      0.001      0.000      0.001        0.999
## 186      F41      0.000      0.001      0.920      1.000        0.000
## 187      F42      0.000      0.001      0.995      1.000        0.000
## 188      F43      0.000      0.001      0.998      1.000        0.000
## 189      F44      0.000      0.001      0.998      1.000        0.000
## 190      F45      0.000      0.001      0.996      1.000        0.000
## 191      F46      0.000      0.001      0.988      1.000        0.000
## 192      F47      0.000      0.001      0.996      1.000        0.000
## 193      F48      0.000      0.001      0.995      1.000        0.000
## 194      F49      0.000      0.001      0.000      0.001        0.999
## 195       F5      0.000      0.001      0.000      0.001        0.999
## 196      F50      0.000      0.001      0.000      0.001        0.999
## 197      F51      0.000      0.001      0.000      0.001        0.991
## 198      F52      0.000      0.001      0.000      0.001        0.999
## 199      F54      0.999      1.000      0.000      0.001        0.000
## 200      F55      0.000      0.001      0.998      1.000        0.000
## 201      F56      0.000      0.001      0.997      1.000        0.000
## 202      F57      0.000      0.001      0.998      1.000        0.000
## 203      F58      0.000      0.001      0.998      1.000        0.000
## 204      F59      0.000      0.001      0.000      0.001        0.999
## 205      F60      0.000      0.001      0.000      0.001        0.999
## 206      F61      0.000      0.001      0.000      0.001        0.999
## 207      F62      0.000      0.001      0.000      0.001        0.999
## 208      F63      0.000      0.001      0.998      1.000        0.000
## 209      F64      0.000      0.001      0.967      1.000        0.000
## 210      F65      0.999      1.000      0.000      0.001        0.000
## 211      F66      0.998      1.000      0.000      0.001        0.000
## 212      F67      0.000      0.001      0.997      1.000        0.000
## 213      F68      0.000      0.022      0.976      1.000        0.000
## 214      F69      0.000      0.001      0.998      1.000        0.000
## 215      F70      0.000      0.001      0.997      1.000        0.000
## 216      F71      0.000      0.001      0.000      0.001        0.998
## 217      F72      0.000      0.001      0.000      0.001        0.999
## 218      F73      0.000      0.001      0.000      0.001        0.999
## 219      F74      0.000      0.001      0.000      0.001        0.998
## 220      F75      0.000      0.001      0.000      0.001        0.000
## 221      F76      0.000      0.001      0.000      0.001        0.000
## 222      F77      0.000      0.001      0.000      0.001        0.000
## 223      F78      0.005      0.044      0.036      0.110        0.000
## 224      F79      0.000      0.001      0.991      1.000        0.000
## 225      F80      0.000      0.001      0.991      1.000        0.000
## 226      F81      0.000      0.001      0.998      1.000        0.000
## 227      F82      0.000      0.001      0.996      1.000        0.000
## 228      F83      0.000      0.001      0.000      0.002        0.000
## 229      F84      0.022      0.055      0.050      0.128        0.000
## 230      F85      0.998      1.000      0.000      0.001        0.000
## 231      F86      0.000      0.001      0.996      1.000        0.000
## 232      F87      0.000      0.026      0.959      1.000        0.000
## 233      F88      0.000      0.001      0.997      1.000        0.000
## 234      F89      0.000      0.001      0.946      1.000        0.000
## 235       F9      0.000      0.001      0.000      0.001        0.998
## 236      F90      0.000      0.001      0.996      1.000        0.000
## 237 F91_2019      0.000      0.001      0.000      0.001        0.999
## 238      F92      0.000      0.001      0.419      0.541        0.000
## 239      F93      0.000      0.001      0.000      0.004        0.000
## 240      F94      0.000      0.054      0.099      0.202        0.000
## 241      F95      0.000      0.001      0.054      0.126        0.000
## 242      F96      0.000      0.015      0.269      0.384        0.000
## 243  G01_rep      0.106      0.161      0.839      0.894        0.000
## 244      G10      0.055      0.091      0.000      0.001        0.000
## 245      G11      0.000      0.001      0.073      0.156        0.000
## 246      G12      0.018      0.043      0.000      0.001        0.000
## 247      G13      0.999      1.000      0.000      0.001        0.000
## 248      G14      0.999      1.000      0.000      0.001        0.000
## 249      G15      0.998      1.000      0.000      0.001        0.000
## 250      G16      0.991      1.000      0.000      0.001        0.000
## 251  G17_rep      0.000      0.001      0.000      0.001        0.999
## 252  G18_rep      0.000      0.001      0.000      0.001        0.998
## 253      G19      0.000      0.002      0.301      0.425        0.000
## 254       G2      0.019      0.053      0.733      0.832        0.000
## 255      G20      0.000      0.001      0.000      0.001        0.000
## 256      G21      0.020      0.048      0.000      0.001        0.000
## 257      G22      0.034      0.068      0.000      0.001        0.000
## 258      G23      0.000      0.004      0.000      0.001        0.000
## 259      G24      0.000      0.001      0.000      0.001        0.000
## 260      G25      0.000      0.001      0.000      0.001        0.000
## 261      G26      0.000      0.001      0.000      0.001        0.000
## 262      G27      0.000      0.001      0.000      0.001        0.000
## 263      G28      0.027      0.057      0.000      0.001        0.000
## 264      G29      0.006      0.027      0.000      0.001        0.000
## 265       G3      0.977      1.000      0.000      0.002        0.000
## 266      G30      0.000      0.001      0.000      0.001        0.000
## 267      G31      0.000      0.001      0.000      0.001        0.000
## 268      G32      0.000      0.001      0.000      0.001        0.000
## 269      G33      0.000      0.001      0.000      0.009        0.000
## 270      G34      0.000      0.006      0.000      0.008        0.000
## 271      G35      0.000      0.001      0.053      0.143        0.000
## 272      G36      0.000      0.001      0.000      0.001        0.000
## 273      G37      0.000      0.001      0.000      0.001        0.000
## 274      G38      0.000      0.001      0.554      0.673        0.000
## 275      G39      0.028      0.070      0.000      0.023        0.000
## 276       G4      0.997      1.000      0.000      0.001        0.000
## 277      G40      0.000      0.001      0.027      0.087        0.000
## 278  G41_rep      0.000      0.001      0.000      0.001        0.000
## 279      G42      0.000      0.001      0.000      0.001        0.000
## 280      G43      0.000      0.001      0.996      1.000        0.000
## 281      G44      0.000      0.001      0.998      1.000        0.000
## 282      G45      0.000      0.001      0.991      1.000        0.000
## 283      G46      0.000      0.001      0.998      1.000        0.000
## 284  G47_rep      0.000      0.001      0.000      0.001        0.999
## 285  G48_rep      0.000      0.001      0.000      0.001        0.071
## 286      G49      0.000      0.001      0.000      0.014        0.000
## 287   G5_rep      0.000      0.001      0.311      0.378        0.621
## 288      G50      0.065      0.105      0.000      0.001        0.000
## 289      G52      0.000      0.001      0.207      0.304        0.000
## 290      G53      0.000      0.001      0.000      0.001        0.000
## 291      G54      0.000      0.001      0.000      0.001        0.000
## 292      G55      0.000      0.004      0.000      0.001        0.000
## 293      G56      0.000      0.001      0.000      0.001        0.000
## 294      G57      0.998      1.000      0.000      0.001        0.000
## 295      G58      0.999      1.000      0.000      0.001        0.000
## 296      G59      0.982      1.000      0.000      0.002        0.000
## 297       G6      0.000      0.001      0.053      0.114        0.000
## 298      G60      0.999      1.000      0.000      0.001        0.000
## 299      G61      0.000      0.001      0.000      0.001        0.000
## 300      G62      0.000      0.001      0.000      0.001        0.000
## 301      G63      0.000      0.009      0.121      0.209        0.000
## 302      G64      0.000      0.004      0.000      0.045        0.000
## 303      G65      0.000      0.001      0.000      0.001        0.000
## 304      G66      0.000      0.001      0.000      0.001        0.000
## 305      G67      0.000      0.001      0.000      0.002        0.000
## 306      G68      0.000      0.001      0.000      0.001        0.000
## 307      G69      0.000      0.014      0.000      0.001        0.000
## 308   G7_rep      0.000      0.001      0.000      0.001        0.998
## 309      G70      0.000      0.001      0.000      0.001        0.000
## 310      G71      0.000      0.001      0.000      0.001        0.033
## 311      G72      0.000      0.001      0.000      0.001        0.000
## 312      G73      0.999      1.000      0.000      0.001        0.000
## 313      G74      0.998      1.000      0.000      0.001        0.000
## 314      G76      0.999      1.000      0.000      0.001        0.000
## 315      G77      0.999      1.000      0.000      0.001        0.000
## 316      G78      0.000      0.001      0.827      0.918        0.000
## 317      G79      0.000      0.001      0.000      0.001        0.000
## 318   G8_rep      0.000      0.001      0.000      0.001        0.998
## 319      G80      0.009      0.040      0.000      0.003        0.000
## 320      G81      0.000      0.001      0.011      0.056        0.000
## 321      G82      0.000      0.001      0.000      0.001        0.000
## 322      G83      0.000      0.001      0.193      0.329        0.000
## 323      G84      0.000      0.018      0.000      0.002        0.000
## 324      G85      0.000      0.001      0.996      1.000        0.000
## 325      G86      0.000      0.001      0.996      1.000        0.000
## 326      G87      0.093      0.149      0.850      0.907        0.000
## 327      G88      0.000      0.001      0.991      1.000        0.000
## 328      G89      0.000      0.001      0.000      0.001        0.999
## 329       G9      0.000      0.001      0.163      0.256        0.000
## 330      G90      0.000      0.001      0.000      0.001        0.999
## 331      G92      0.000      0.001      0.000      0.001        0.999
## 332      G94      0.000      0.001      0.000      0.001        0.000
## 333       H1      0.000      0.005      0.946      0.985        0.013
## 334      H10      0.000      0.048      0.626      0.755        0.027
## 335  H11_rep      0.000      0.024      0.000      0.001        0.888
## 336      H12      0.000      0.001      0.195      0.294        0.000
## 337      H13      0.000      0.001      0.000      0.001        0.999
## 338      H14      0.000      0.001      0.000      0.001        0.999
## 339      H15      0.000      0.001      0.000      0.001        0.999
## 340      H16      0.000      0.001      0.000      0.001        0.999
## 341      H17      0.000      0.045      0.000      0.112        0.000
## 342      H18      0.000      0.028      0.000      0.001        0.000
## 343      H19      0.000      0.001      0.047      0.106        0.000
## 344       H2      0.000      0.001      0.817      0.914        0.033
## 345      H20      0.000      0.001      0.000      0.001        0.000
## 346      H21      0.000      0.001      0.140      0.227        0.000
## 347      H22      0.000      0.002      0.427      0.545        0.000
## 348      H23      0.012      0.043      0.144      0.239        0.000
## 349      H24      0.057      0.118      0.000      0.041        0.000
## 350      H25      0.000      0.001      0.000      0.001        0.000
## 351      H26      0.185      0.248      0.000      0.001        0.000
## 352      H27      0.000      0.001      0.000      0.001        0.000
## 353      H28      0.000      0.008      0.000      0.051        0.000
## 354      H29      0.000      0.001      0.000      0.001        0.999
## 355       H3      0.000      0.001      0.918      1.000        0.000
## 356      H30      0.000      0.001      0.000      0.001        0.999
## 357      H31      0.000      0.001      0.000      0.001        0.998
## 358      H32      0.000      0.001      0.000      0.001        0.999
## 359      H33      0.000      0.001      0.964      1.000        0.000
## 360      H34      0.000      0.001      0.911      0.971        0.027
## 361      H35      0.000      0.001      0.904      1.000        0.000
## 362      H36      0.000      0.001      0.998      1.000        0.000
## 363      H37      0.000      0.001      0.000      0.001        0.999
## 364      H38      0.000      0.001      0.000      0.001        0.999
## 365      H39      0.000      0.001      0.000      0.001        0.999
## 366       H4      0.000      0.001      0.000      0.001        0.999
## 367      H40      0.000      0.001      0.000      0.001        0.999
## 368      H41      0.000      0.001      0.000      0.001        0.000
## 369      H42      0.000      0.001      0.000      0.005        0.067
## 370      H43      0.000      0.001      0.000      0.001        0.999
## 371      H44      0.000      0.001      0.000      0.001        0.999
## 372      H45      0.000      0.001      0.000      0.001        0.999
## 373      H46      0.000      0.001      0.000      0.001        0.999
## 374      H47      0.000      0.001      0.876      0.974        0.000
## 375      H48      0.000      0.001      0.998      1.000        0.000
## 376      H49      0.000      0.001      0.996      1.000        0.000
## 377       H5      0.000      0.001      0.000      0.001        0.999
## 378      H50      0.000      0.001      0.994      1.000        0.000
## 379      H51      0.000      0.001      0.000      0.001        0.997
## 380      H52      0.000      0.001      0.000      0.001        0.999
## 381      H53      0.000      0.001      0.000      0.001        0.999
## 382      H54      0.000      0.001      0.000      0.001        0.999
## 383      H55      0.000      0.001      0.815      0.911        0.000
## 384      H56      0.000      0.001      0.993      1.000        0.000
## 385      H57      0.000      0.001      0.996      1.000        0.000
## 386      H58      0.000      0.001      0.993      1.000        0.000
## 387      H59      0.000      0.001      0.000      0.001        0.999
## 388       H6      0.000      0.001      0.000      0.001        0.999
## 389      H60      0.000      0.001      0.000      0.001        0.999
## 390      H62      0.000      0.001      0.000      0.001        0.999
## 391      H63      0.000      0.001      0.000      0.001        0.000
## 392      H64      0.000      0.001      0.604      0.721        0.000
## 393  H65_rep      0.000      0.001      0.000      0.001        0.999
## 394  H66_rep      0.000      0.001      0.000      0.001        0.999
## 395      H67      0.000      0.001      0.367      0.488        0.000
## 396      H68      0.000      0.001      0.413      0.533        0.000
## 397  H69_rep      0.000      0.005      0.000      0.020        0.977
## 398       H7      0.000      0.001      0.000      0.001        0.999
## 399      H70      0.000      0.001      0.000      0.020        0.000
## 400      H71      0.000      0.016      0.099      0.188        0.000
## 401      H72      0.000      0.001      0.000      0.001        0.000
## 402   H8_rep      0.000      0.001      0.000      0.001        0.999
## 403       H9      0.000      0.001      0.492      0.613        0.000
## 404      I01      0.000      0.002      0.000      0.001        0.990
## 405      I02      0.000      0.001      0.000      0.001        0.997
## 406      I03      0.000      0.001      0.000      0.001        0.999
## 407      I04      0.000      0.001      0.000      0.002        0.962
## 408      I05      0.000      0.001      0.000      0.003        0.981
## 409      I06      0.000      0.001      0.000      0.001        0.999
## 410      I07      0.000      0.001      0.000      0.001        0.999
## 411      I08      0.000      0.001      0.000      0.001        0.998
## 412      I09      0.000      0.001      0.000      0.001        0.999
## 413      I10      0.000      0.001      0.000      0.001        0.999
## 414      I11      0.000      0.001      0.000      0.001        0.999
## 415      I12      0.000      0.001      0.000      0.001        0.999
## 416      I13      0.000      0.001      0.000      0.001        0.999
## 417      I14      0.000      0.001      0.000      0.001        0.999
## 418      I15      0.000      0.001      0.000      0.001        0.999
## 419      I16      0.000      0.001      0.000      0.001        0.999
## 420      I17      0.000      0.001      0.000      0.001        0.998
## 421      I18      0.000      0.001      0.000      0.001        0.999
## 422      I19      0.000      0.001      0.000      0.001        0.999
## 423      I20      0.000      0.001      0.000      0.001        0.999
## 424      I21      0.000      0.001      0.000      0.001        0.999
## 425      I22      0.000      0.001      0.000      0.001        0.999
## 426      I23      0.000      0.001      0.000      0.001        0.999
## 427      I24      0.000      0.001      0.000      0.001        0.999
## 428      J14      0.000      0.009      0.000      0.013        0.000
## 429      J15      0.000      0.001      0.000      0.001        0.000
## 430      J16      0.000      0.001      0.000      0.001        0.000
## 431      J17      0.000      0.001      0.000      0.001        0.000
## 432      J18      0.000      0.016      0.000      0.001        0.000
## 433      J19      0.000      0.001      0.000      0.001        0.000
## 434      J20      0.000      0.001      0.000      0.001        0.000
## 435      J21      0.000      0.001      0.000      0.001        0.000
## 436      J22      0.000      0.001      0.000      0.001        0.000
## 437      J23      0.000      0.001      0.000      0.001        0.000
## 438      J24      0.000      0.001      0.000      0.001        0.000
## 439      J25      0.000      0.001      0.000      0.001        0.000
## 440      J26      0.000      0.001      0.000      0.001        0.000
## 441      J27      0.000      0.001      0.000      0.001        0.000
## 442       K1      0.000      0.001      0.000      0.001        0.000
## 443       K2      0.000      0.001      0.000      0.001        0.000
## 444       K3      0.000      0.001      0.000      0.001        0.000
## 445      K32      0.000      0.001      0.000      0.001        0.000
## 446      K33      0.000      0.001      0.000      0.004        0.000
## 447      K34      0.000      0.001      0.000      0.001        0.000
## 448       K4      0.000      0.001      0.000      0.001        0.000
## 449       K5      0.000      0.001      0.000      0.001        0.000
## 450       L1      0.000      0.001      0.000      0.001        0.000
## 451      L10      0.000      0.001      0.000      0.001        0.000
## 452      L11      0.000      0.001      0.000      0.001        0.000
## 453      L12      0.000      0.001      0.000      0.001        0.000
## 454      L13      0.000      0.002      0.000      0.003        0.000
## 455      L14      0.000      0.001      0.000      0.001        0.000
## 456      L15      0.000      0.001      0.000      0.001        0.000
## 457      L16      0.000      0.001      0.000      0.001        0.000
## 458      L17      0.000      0.001      0.000      0.001        0.000
## 459  L18_rep      0.000      0.001      0.000      0.001        0.000
## 460      L19      0.000      0.001      0.000      0.001        0.000
## 461       L2      0.000      0.001      0.000      0.002        0.000
## 462      L20      0.000      0.001      0.000      0.001        0.000
## 463      L21      0.000      0.001      0.000      0.001        0.000
## 464      L22      0.000      0.001      0.000      0.001        0.000
## 465      L23      0.000      0.001      0.000      0.001        0.000
## 466      L24      0.000      0.002      0.000      0.001        0.000
## 467      L26      0.000      0.001      0.000      0.001        0.000
## 468      L27      0.000      0.001      0.000      0.001        0.000
## 469      L28      0.000      0.001      0.000      0.001        0.000
## 470       L3      0.000      0.001      0.000      0.001        0.000
## 471       L4      0.000      0.001      0.000      0.001        0.000
## 472       L5      0.000      0.002      0.000      0.001        0.000
## 473       L6      0.000      0.001      0.000      0.001        0.000
## 474       L7      0.000      0.001      0.000      0.014        0.000
## 475       L8      0.000      0.001      0.000      0.001        0.000
## 476   L9_rep      0.000      0.001      0.000      0.001        0.000
## 477       N1      0.000      0.001      0.000      0.001        0.000
## 478      N10      0.000      0.001      0.000      0.003        0.000
## 479      N11      0.000      0.001      0.000      0.001        0.000
## 480      N12      0.000      0.001      0.000      0.001        0.000
## 481      N13      0.000      0.001      0.000      0.001        0.000
## 482      N14      0.000      0.001      0.000      0.001        0.000
## 483      N15      0.000      0.001      0.000      0.001        0.000
## 484      N16      0.000      0.001      0.000      0.001        0.000
## 485      N17      0.000      0.001      0.000      0.001        0.000
## 486      N18      0.000      0.001      0.000      0.001        0.000
## 487      N19      0.000      0.001      0.000      0.003        0.000
## 488      N20      0.000      0.001      0.000      0.001        0.000
## 489      N21      0.000      0.001      0.000      0.001        0.000
## 490      N24      0.000      0.001      0.000      0.001        0.000
## 491      N25      0.000      0.001      0.000      0.001        0.000
## 492      N26      0.000      0.001      0.000      0.003        0.000
## 493      N27      0.000      0.001      0.000      0.001        0.000
## 494      N28      0.000      0.001      0.000      0.001        0.000
## 495       N3      0.000      0.001      0.000      0.001        0.012
## 496       N4      0.000      0.001      0.000      0.001        0.000
## 497       N5      0.000      0.001      0.000      0.001        0.000
## 498       N6      0.000      0.001      0.000      0.001        0.000
## 499       N7      0.000      0.001      0.000      0.001        0.071
## 500       N8      0.000      0.001      0.000      0.002        0.000
## 501       N9      0.000      0.001      0.000      0.001        0.000
## 502       Q1      0.000      0.001      0.998      1.000        0.000
## 503      Q11      0.000      0.001      0.998      1.000        0.000
## 504      Q12      0.000      0.001      0.997      1.000        0.000
## 505      Q13      0.000      0.001      0.990      1.000        0.000
## 506      Q14      0.000      0.001      0.998      1.000        0.000
## 507      Q15      0.000      0.001      0.934      1.000        0.000
## 508       Q2      0.000      0.001      0.997      1.000        0.000
## 509       Q3      0.000      0.001      0.998      1.000        0.000
## 510       Q4      0.000      0.001      0.998      1.000        0.000
## 511       Q5      0.000      0.001      0.986      1.000        0.000
## 512       Q6      0.000      0.001      0.963      1.000        0.000
## 513       Q7      0.000      0.001      0.997      1.000        0.000
## 514       Q8      0.000      0.001      0.997      1.000        0.000
## 515       Q9      0.000      0.001      0.992      1.000        0.000
## 516      R10      0.000      0.001      0.000      0.001        0.000
## 517      R11      0.000      0.001      0.000      0.004        0.000
## 518      R12      0.000      0.001      0.000      0.001        0.000
## 519      R13      0.000      0.001      0.000      0.001        0.000
## 520      R14      0.000      0.001      0.000      0.001        0.000
## 521      R15      0.000      0.001      0.000      0.001        0.000
## 522      R16      0.000      0.001      0.000      0.001        0.000
## 523      R17      0.000      0.001      0.000      0.001        0.000
## 524      R18      0.000      0.001      0.000      0.001        0.000
## 525      R19      0.000      0.001      0.000      0.014        0.000
## 526       R2      0.000      0.001      0.000      0.001        0.000
## 527      R20      0.000      0.001      0.000      0.001        0.000
## 528       R3      0.000      0.001      0.000      0.012        0.000
## 529       R5      0.000      0.001      0.000      0.001        0.000
## 530       R6      0.000      0.001      0.000      0.001        0.000
## 531       R7      0.000      0.001      0.000      0.001        0.000
## 532       R9      0.000      0.001      0.000      0.001        0.000
## 533       S1      0.000      0.001      0.000      0.001        0.000
## 534  S11_rep      0.000      0.001      0.000      0.001        0.000
## 535      S12      0.000      0.001      0.000      0.001        0.000
## 536      S13      0.000      0.001      0.000      0.001        0.000
## 537      S15      0.000      0.001      0.000      0.001        0.000
## 538      S16      0.000      0.001      0.000      0.001        0.000
## 539      S17      0.000      0.001      0.000      0.001        0.000
## 540      S18      0.000      0.001      0.000      0.001        0.000
## 541      S19      0.000      0.001      0.000      0.001        0.000
## 542       S2      0.000      0.001      0.000      0.001        0.000
## 543      S20      0.000      0.001      0.000      0.001        0.000
## 544      S21      0.000      0.001      0.000      0.001        0.000
## 545      S22      0.000      0.001      0.000      0.001        0.000
## 546      S23      0.000      0.001      0.000      0.001        0.000
## 547      S24      0.000      0.001      0.000      0.001        0.000
## 548       S3      0.000      0.001      0.000      0.001        0.000
## 549       S4      0.000      0.001      0.000      0.001        0.000
## 550       S6      0.000      0.001      0.000      0.001        0.000
## 551       S7      0.000      0.001      0.000      0.001        0.000
## 552       S8      0.000      0.001      0.000      0.001        0.000
## 553       S9      0.000      0.001      0.000      0.001        0.000
##     carinulata_H sublineata_L sublineata_H elongata carinata carinulata
## 1          0.001        0.000        0.001    1.000    0.000      0.000
## 2          0.001        0.000        0.001    1.000    0.000      0.000
## 3          0.001        0.000        0.001    1.000    0.000      0.000
## 4          0.078        0.000        0.028    0.936    0.000      0.058
## 5          0.001        0.000        0.001    1.000    0.000      0.000
## 6          0.001        0.000        0.001    1.000    0.000      0.000
## 7          0.001        0.000        0.001    1.000    0.000      0.000
## 8          0.001        0.000        0.001    1.000    0.000      0.000
## 9          0.001        0.000        0.001    1.000    0.000      0.000
## 10         0.001        0.000        0.001    1.000    0.000      0.000
## 11         0.001        0.000        0.001    1.000    0.000      0.000
## 12         0.001        0.000        0.001    1.000    0.000      0.000
## 13         0.001        0.000        0.001    1.000    0.000      0.000
## 14         0.079        0.000        0.001    0.942    0.000      0.058
## 15         0.001        0.000        0.001    1.000    0.000      0.000
## 16         0.001        0.000        0.001    1.000    0.000      0.000
## 17         0.001        0.000        0.001    1.000    0.000      0.000
## 18         0.001        0.000        0.001    1.000    0.000      0.000
## 19         0.001        0.000        0.001    1.000    0.000      0.000
## 20         0.001        0.000        0.001    1.000    0.000      0.000
## 21         0.001        0.000        0.001    1.000    0.000      0.000
## 22         0.001        0.000        0.001    1.000    0.000      0.000
## 23         0.001        0.000        0.001    1.000    0.000      0.000
## 24         0.001        0.000        0.001    1.000    0.000      0.000
## 25         0.001        0.000        0.001    1.000    0.000      0.000
## 26         0.001        0.000        0.001    1.000    0.000      0.000
## 27         0.001        0.000        0.001    1.000    0.000      0.000
## 28         0.001        0.000        0.001    1.000    0.000      0.000
## 29         0.001        0.000        0.001    1.000    0.000      0.000
## 30         0.001        0.000        0.001    1.000    0.000      0.000
## 31         0.001        0.000        0.001    1.000    0.000      0.000
## 32         0.001        0.000        0.001    1.000    0.000      0.000
## 33         0.001        0.000        0.001    1.000    0.000      0.000
## 34         0.001        0.000        0.001    1.000    0.000      0.000
## 35         0.001        0.000        0.001    1.000    0.000      0.000
## 36         0.001        0.000        0.001    1.000    0.000      0.000
## 37         0.001        0.000        0.001    1.000    0.000      0.000
## 38         0.001        0.000        0.001    1.000    0.000      0.000
## 39         0.001        0.000        0.001    1.000    0.000      0.000
## 40         0.001        0.000        0.001    1.000    0.000      0.000
## 41         0.001        0.000        0.001    1.000    0.000      0.000
## 42         0.001        0.000        0.001    1.000    0.000      0.000
## 43         0.001        0.000        0.001    1.000    0.000      0.000
## 44         0.001        0.000        0.001    1.000    0.000      0.000
## 45         0.001        0.000        0.001    1.000    0.000      0.000
## 46         0.001        0.000        0.001    1.000    0.000      0.000
## 47         0.001        0.000        0.001    1.000    0.000      0.000
## 48         0.001        0.000        0.001    1.000    0.000      0.000
## 49         0.001        0.000        0.001    1.000    0.000      0.000
## 50         0.014        0.000        0.004    0.997    0.000      0.002
## 51         0.001        0.000        0.001    1.000    0.000      0.000
## 52         0.139        0.000        0.002    0.885    0.000      0.114
## 53         0.009        0.000        0.001    0.999    0.000      0.001
## 54         0.001        0.000        0.001    1.000    0.000      0.000
## 55         0.001        0.000        0.001    1.000    0.000      0.000
## 56         0.001        0.000        0.001    1.000    0.000      0.000
## 57         0.001        0.000        0.001    1.000    0.000      0.000
## 58         0.001        0.000        0.001    1.000    0.000      0.000
## 59         0.001        0.000        0.001    1.000    0.000      0.000
## 60         0.001        0.000        0.001    1.000    0.000      0.000
## 61         0.001        0.000        0.001    1.000    0.000      0.000
## 62         0.001        0.000        0.001    1.000    0.000      0.000
## 63         0.001        0.000        0.001    1.000    0.000      0.000
## 64         0.001        0.000        0.001    1.000    0.000      0.000
## 65         0.001        0.000        0.001    1.000    0.000      0.000
## 66         0.001        0.000        0.001    1.000    0.000      0.000
## 67         0.001        0.000        0.001    1.000    0.000      0.000
## 68         0.001        0.000        0.001    1.000    0.000      0.000
## 69         0.001        0.000        0.001    1.000    0.000      0.000
## 70         0.001        0.000        0.001    1.000    0.000      0.000
## 71         0.001        0.000        0.001    1.000    0.000      0.000
## 72         0.001        0.000        0.001    1.000    0.000      0.000
## 73         0.001        0.000        0.001    1.000    0.000      0.000
## 74         0.001        0.000        0.001    0.999    0.000      0.000
## 75         0.001        0.000        0.001    1.000    0.000      0.000
## 76         0.001        0.000        0.001    1.000    0.000      0.000
## 77         1.000        0.000        0.001    0.000    0.000      1.000
## 78         1.000        0.000        0.001    0.000    0.000      1.000
## 79         1.000        0.000        0.001    0.000    0.000      1.000
## 80         1.000        0.000        0.001    0.000    0.000      1.000
## 81         1.000        0.000        0.001    0.000    0.000      1.000
## 82         1.000        0.000        0.001    0.000    0.000      1.000
## 83         1.000        0.000        0.001    0.000    0.000      1.000
## 84         1.000        0.000        0.001    0.000    0.000      1.000
## 85         1.000        0.000        0.001    0.000    0.000      1.000
## 86         1.000        0.000        0.001    0.000    0.000      1.000
## 87         1.000        0.000        0.001    0.000    0.000      1.000
## 88         1.000        0.000        0.001    0.000    0.000      1.000
## 89         1.000        0.000        0.001    0.000    0.000      1.000
## 90         1.000        0.000        0.001    0.000    0.000      1.000
## 91         1.000        0.000        0.001    0.000    0.000      1.000
## 92         1.000        0.000        0.001    0.000    0.000      1.000
## 93         1.000        0.000        0.001    0.000    0.000      1.000
## 94         1.000        0.000        0.001    0.000    0.000      1.000
## 95         0.001        0.000        0.002    0.247    0.752      0.000
## 96         1.000        0.000        0.001    0.000    0.000      1.000
## 97         0.001        0.000        0.008    0.000    0.999      0.000
## 98         1.000        0.000        0.001    0.000    0.000      1.000
## 99         1.000        0.000        0.001    0.000    0.000      1.000
## 100        1.000        0.000        0.001    0.000    0.000      1.000
## 101        1.000        0.000        0.001    0.000    0.000      1.000
## 102        1.000        0.000        0.001    0.000    0.000      1.000
## 103        1.000        0.000        0.001    0.000    0.000      1.000
## 104        1.000        0.000        0.001    0.000    0.000      1.000
## 105        1.000        0.000        0.001    0.000    0.000      1.000
## 106        1.000        0.000        0.001    0.000    0.000      1.000
## 107        1.000        0.000        0.001    0.000    0.000      1.000
## 108        1.000        0.000        0.001    0.000    0.000      1.000
## 109        1.000        0.000        0.001    0.000    0.000      1.000
## 110        1.000        0.000        0.001    0.000    0.000      1.000
## 111        1.000        0.000        0.001    0.000    0.000      1.000
## 112        1.000        0.000        0.001    0.000    0.000      1.000
## 113        1.000        0.000        0.001    0.000    0.000      1.000
## 114        1.000        0.000        0.001    0.000    0.000      1.000
## 115        1.000        0.000        0.001    0.000    0.000      1.000
## 116        1.000        0.000        0.001    0.000    0.000      1.000
## 117        1.000        0.000        0.001    0.000    0.000      1.000
## 118        1.000        0.000        0.001    0.000    0.000      1.000
## 119        1.000        0.000        0.001    0.000    0.000      1.000
## 120        1.000        0.000        0.001    0.000    0.000      1.000
## 121        1.000        0.000        0.001    0.000    0.000      1.000
## 122        1.000        0.000        0.001    0.000    0.000      1.000
## 123        1.000        0.000        0.001    0.000    0.000      1.000
## 124        1.000        0.000        0.001    0.000    0.000      1.000
## 125        1.000        0.000        0.001    0.000    0.000      1.000
## 126        1.000        0.000        0.001    0.000    0.000      1.000
## 127        1.000        0.000        0.001    0.000    0.000      1.000
## 128        1.000        0.000        0.001    0.000    0.000      1.000
## 129        1.000        0.000        0.001    0.000    0.000      1.000
## 130        1.000        0.000        0.001    0.000    0.000      1.000
## 131        1.000        0.000        0.001    0.000    0.000      1.000
## 132        1.000        0.000        0.001    0.000    0.000      1.000
## 133        1.000        0.000        0.001    0.000    0.000      1.000
## 134        1.000        0.000        0.001    0.000    0.000      1.000
## 135        1.000        0.000        0.001    0.000    0.000      1.000
## 136        1.000        0.000        0.001    0.000    0.000      1.000
## 137        1.000        0.000        0.001    0.000    0.000      1.000
## 138        1.000        0.000        0.001    0.000    0.000      1.000
## 139        1.000        0.000        0.001    0.000    0.000      1.000
## 140        1.000        0.000        0.001    0.000    0.000      1.000
## 141        1.000        0.000        0.001    0.000    0.000      1.000
## 142        1.000        0.000        0.001    0.000    0.000      1.000
## 143        1.000        0.000        0.001    0.000    0.000      1.000
## 144        1.000        0.000        0.001    0.000    0.000      1.000
## 145        1.000        0.000        0.001    0.000    0.000      1.000
## 146        1.000        0.000        0.001    0.000    0.000      1.000
## 147        1.000        0.000        0.001    0.000    0.000      1.000
## 148        1.000        0.000        0.001    0.000    0.000      1.000
## 149        1.000        0.000        0.001    0.000    0.000      1.000
## 150        1.000        0.000        0.001    0.000    0.000      1.000
## 151        1.000        0.000        0.001    0.000    0.000      1.000
## 152        1.000        0.000        0.001    0.000    0.000      1.000
## 153        1.000        0.000        0.001    0.000    0.000      1.000
## 154        1.000        0.000        0.001    0.000    0.000      1.000
## 155        1.000        0.000        0.001    0.000    0.000      1.000
## 156        1.000        0.000        0.001    0.000    0.000      1.000
## 157        1.000        0.000        0.001    0.000    0.000      1.000
## 158        1.000        0.000        0.001    0.000    0.000      1.000
## 159        1.000        0.000        0.001    0.000    0.000      1.000
## 160        1.000        0.000        0.001    0.000    0.000      1.000
## 161        1.000        0.000        0.001    0.000    0.000      1.000
## 162        1.000        0.000        0.001    0.000    0.000      1.000
## 163        1.000        0.000        0.001    0.000    0.000      1.000
## 164        1.000        0.000        0.001    0.000    0.000      1.000
## 165        1.000        0.000        0.006    0.000    0.001      0.999
## 166        1.000        0.000        0.001    0.000    0.000      1.000
## 167        1.000        0.000        0.001    0.000    0.000      1.000
## 168        1.000        0.000        0.003    0.000    0.000      0.999
## 169        1.000        0.000        0.001    0.000    0.000      1.000
## 170        1.000        0.000        0.001    0.000    0.000      1.000
## 171        1.000        0.000        0.001    0.000    0.000      1.000
## 172        1.000        0.000        0.001    0.000    0.000      1.000
## 173        1.000        0.000        0.001    0.000    0.000      1.000
## 174        1.000        0.000        0.001    0.000    0.000      1.000
## 175        1.000        0.000        0.001    0.000    0.000      1.000
## 176        0.001        0.000        0.002    0.000    1.000      0.000
## 177        0.001        0.000        0.002    0.000    1.000      0.000
## 178        0.001        0.000        0.057    0.000    0.987      0.000
## 179        0.001        0.000        0.002    0.000    1.000      0.000
## 180        0.001        0.000        0.001    0.000    1.000      0.000
## 181        0.001        0.000        0.002    0.000    1.000      0.000
## 182        1.000        0.000        0.001    0.000    0.000      1.000
## 183        1.000        0.000        0.001    0.000    0.000      1.000
## 184        1.000        0.000        0.001    0.000    0.000      1.000
## 185        1.000        0.000        0.001    0.000    0.000      1.000
## 186        0.001        0.000        0.080    0.000    0.970      0.000
## 187        0.001        0.000        0.003    0.000    0.999      0.000
## 188        0.001        0.000        0.001    0.000    1.000      0.000
## 189        0.001        0.000        0.001    0.000    1.000      0.000
## 190        0.001        0.000        0.003    0.000    0.999      0.000
## 191        0.001        0.000        0.012    0.000    0.998      0.000
## 192        0.001        0.000        0.003    0.000    0.999      0.000
## 193        0.001        0.000        0.004    0.000    0.999      0.000
## 194        1.000        0.000        0.001    0.000    0.000      1.000
## 195        1.000        0.000        0.001    0.000    0.000      1.000
## 196        1.000        0.000        0.001    0.000    0.000      1.000
## 197        1.000        0.000        0.009    0.000    0.000      0.998
## 198        1.000        0.000        0.001    0.000    0.000      1.000
## 199        0.001        0.000        0.001    1.000    0.000      0.000
## 200        0.001        0.000        0.001    0.000    1.000      0.000
## 201        0.001        0.000        0.002    0.000    0.999      0.000
## 202        0.001        0.000        0.001    0.000    1.000      0.000
## 203        0.001        0.000        0.001    0.000    1.000      0.000
## 204        1.000        0.000        0.001    0.000    0.000      1.000
## 205        1.000        0.000        0.001    0.000    0.000      1.000
## 206        1.000        0.000        0.001    0.000    0.000      1.000
## 207        1.000        0.000        0.001    0.000    0.000      1.000
## 208        0.001        0.000        0.001    0.000    1.000      0.000
## 209        0.001        0.000        0.033    0.000    0.995      0.000
## 210        0.001        0.000        0.001    1.000    0.000      0.000
## 211        0.001        0.000        0.001    1.000    0.000      0.000
## 212        0.001        0.000        0.002    0.000    1.000      0.000
## 213        0.001        0.000        0.008    0.004    0.995      0.000
## 214        0.001        0.000        0.002    0.000    1.000      0.000
## 215        0.001        0.000        0.002    0.000    1.000      0.000
## 216        1.000        0.000        0.001    0.000    0.000      1.000
## 217        1.000        0.000        0.001    0.000    0.000      1.000
## 218        1.000        0.000        0.001    0.000    0.000      1.000
## 219        1.000        0.000        0.001    0.000    0.000      1.000
## 220        0.001        0.997        1.000    0.000    0.000      0.000
## 221        0.001        0.999        1.000    0.000    0.000      0.000
## 222        0.001        0.998        1.000    0.000    0.000      0.000
## 223        0.001        0.869        0.935    0.025    0.071      0.000
## 224        0.001        0.000        0.009    0.000    0.999      0.000
## 225        0.001        0.000        0.008    0.000    0.999      0.000
## 226        0.001        0.000        0.001    0.000    1.000      0.000
## 227        0.002        0.000        0.001    0.000    0.999      0.000
## 228        0.001        0.995        1.000    0.000    0.000      0.000
## 229        0.001        0.837        0.911    0.037    0.087      0.000
## 230        0.001        0.000        0.001    1.000    0.000      0.000
## 231        0.001        0.000        0.003    0.000    0.999      0.000
## 232        0.024        0.000        0.022    0.003    0.990      0.004
## 233        0.001        0.000        0.002    0.000    0.999      0.000
## 234        0.001        0.000        0.054    0.000    0.988      0.000
## 235        1.000        0.000        0.001    0.000    0.000      1.000
## 236        0.001        0.000        0.003    0.000    0.999      0.000
## 237        1.000        0.000        0.001    0.000    0.000      1.000
## 238        0.001        0.459        0.581    0.000    0.480      0.000
## 239        0.001        0.996        1.000    0.000    0.001      0.000
## 240        0.019        0.768        0.865    0.031    0.148      0.003
## 241        0.001        0.874        0.946    0.000    0.087      0.000
## 242        0.001        0.615        0.729    0.002    0.326      0.000
## 243        0.001        0.000        0.002    0.133    0.867      0.000
## 244        0.001        0.909        0.945    0.072    0.000      0.000
## 245        0.001        0.843        0.927    0.000    0.112      0.000
## 246        0.001        0.957        0.982    0.029    0.000      0.000
## 247        0.001        0.000        0.001    1.000    0.000      0.000
## 248        0.001        0.000        0.001    1.000    0.000      0.000
## 249        0.001        0.000        0.001    1.000    0.000      0.000
## 250        0.001        0.000        0.006    0.999    0.000      0.000
## 251        1.000        0.000        0.001    0.000    0.000      1.000
## 252        1.000        0.000        0.001    0.000    0.000      1.000
## 253        0.001        0.575        0.699    0.000    0.362      0.000
## 254        0.001        0.135        0.230    0.035    0.784      0.000
## 255        0.001        0.997        1.000    0.000    0.000      0.000
## 256        0.001        0.952        0.980    0.033    0.000      0.000
## 257        0.001        0.932        0.966    0.050    0.000      0.000
## 258        0.017        0.982        1.000    0.001    0.000      0.004
## 259        0.001        0.999        1.000    0.000    0.000      0.000
## 260        0.001        0.999        1.000    0.000    0.000      0.000
## 261        0.001        0.999        1.000    0.000    0.000      0.000
## 262        0.001        0.998        1.000    0.000    0.000      0.000
## 263        0.001        0.943        0.973    0.041    0.000      0.000
## 264        0.001        0.972        0.993    0.016    0.000      0.000
## 265        0.001        0.000        0.022    0.996    0.000      0.000
## 266        0.001        0.998        1.000    0.000    0.000      0.000
## 267        0.001        0.998        1.000    0.000    0.000      0.000
## 268        0.001        0.999        1.000    0.000    0.000      0.000
## 269        0.001        0.991        1.000    0.000    0.001      0.000
## 270        0.002        0.989        1.000    0.001    0.001      0.000
## 271        0.001        0.857        0.947    0.000    0.094      0.000
## 272        0.001        0.999        1.000    0.000    0.000      0.000
## 273        0.001        0.999        1.000    0.000    0.000      0.000
## 274        0.001        0.327        0.446    0.000    0.614      0.000
## 275        0.002        0.924        0.969    0.048    0.003      0.000
## 276        0.001        0.000        0.001    1.000    0.000      0.000
## 277        0.001        0.913        0.973    0.000    0.055      0.000
## 278        0.015        0.984        1.000    0.000    0.000      0.004
## 279        0.001        0.998        1.000    0.000    0.000      0.000
## 280        0.001        0.000        0.002    0.000    0.999      0.000
## 281        0.001        0.000        0.001    0.000    1.000      0.000
## 282        0.001        0.000        0.008    0.000    0.999      0.000
## 283        0.001        0.000        0.001    0.000    1.000      0.000
## 284        1.000        0.000        0.001    0.000    0.000      1.000
## 285        0.112        0.888        0.929    0.000    0.000      0.091
## 286        0.001        0.986        1.000    0.000    0.002      0.000
## 287        0.683        0.000        0.023    0.000    0.345      0.652
## 288        0.001        0.895        0.935    0.084    0.000      0.000
## 289        0.001        0.696        0.793    0.000    0.254      0.000
## 290        0.001        0.999        1.000    0.000    0.000      0.000
## 291        0.001        0.998        1.000    0.000    0.000      0.000
## 292        0.017        0.983        1.000    0.000    0.000      0.003
## 293        0.001        0.998        1.000    0.000    0.000      0.000
## 294        0.001        0.000        0.001    1.000    0.000      0.000
## 295        0.001        0.000        0.001    1.000    0.000      0.000
## 296        0.007        0.000        0.015    0.997    0.000      0.001
## 297        0.001        0.886        0.947    0.000    0.082      0.000
## 298        0.001        0.000        0.001    1.000    0.000      0.000
## 299        0.001        0.998        1.000    0.000    0.000      0.000
## 300        0.001        0.998        1.000    0.000    0.000      0.000
## 301        0.001        0.790        0.877    0.001    0.164      0.000
## 302        0.001        0.955        1.000    0.001    0.010      0.000
## 303        0.001        0.998        1.000    0.000    0.000      0.000
## 304        0.001        0.998        1.000    0.000    0.000      0.000
## 305        0.001        0.996        1.000    0.000    0.001      0.000
## 306        0.001        0.999        1.000    0.000    0.000      0.000
## 307        0.001        0.985        1.000    0.003    0.000      0.000
## 308        1.000        0.000        0.001    0.000    0.000      1.000
## 309        0.001        0.999        1.000    0.000    0.000      0.000
## 310        0.066        0.934        0.967    0.000    0.000      0.049
## 311        0.001        0.999        1.000    0.000    0.000      0.000
## 312        0.001        0.000        0.001    1.000    0.000      0.000
## 313        0.001        0.000        0.001    1.000    0.000      0.000
## 314        0.001        0.000        0.001    1.000    0.000      0.000
## 315        0.001        0.000        0.001    1.000    0.000      0.000
## 316        0.001        0.082        0.172    0.000    0.875      0.000
## 317        0.001        0.996        1.000    0.000    0.000      0.000
## 318        1.000        0.000        0.001    0.000    0.000      1.000
## 319        0.001        0.958        0.990    0.024    0.001      0.000
## 320        0.001        0.944        0.989    0.000    0.032      0.000
## 321        0.001        0.998        1.000    0.000    0.000      0.000
## 322        0.001        0.671        0.806    0.000    0.259      0.000
## 323        0.001        0.981        1.000    0.007    0.000      0.000
## 324        0.001        0.000        0.003    0.000    0.999      0.000
## 325        0.001        0.000        0.002    0.000    0.999      0.000
## 326        0.001        0.000        0.001    0.120    0.880      0.000
## 327        0.001        0.000        0.008    0.000    0.999      0.000
## 328        1.000        0.000        0.001    0.000    0.000      1.000
## 329        0.001        0.744        0.837    0.000    0.208      0.000
## 330        1.000        0.000        0.001    0.000    0.000      1.000
## 331        1.000        0.000        0.001    0.000    0.000      1.000
## 332        0.001        0.998        1.000    0.000    0.000      0.000
## 333        0.047        0.000        0.019    0.001    0.967      0.029
## 334        0.073        0.183        0.307    0.014    0.692      0.050
## 335        0.926        0.066        0.109    0.004    0.000      0.908
## 336        0.001        0.706        0.805    0.000    0.242      0.000
## 337        1.000        0.000        0.001    0.000    0.000      1.000
## 338        1.000        0.000        0.001    0.000    0.000      1.000
## 339        1.000        0.000        0.001    0.000    0.000      1.000
## 340        1.000        0.000        0.001    0.000    0.000      1.000
## 341        0.001        0.877        0.958    0.019    0.063      0.000
## 342        0.005        0.972        1.000    0.014    0.000      0.001
## 343        0.001        0.893        0.953    0.000    0.075      0.000
## 344        0.076        0.032        0.130    0.000    0.866      0.054
## 345        0.001        0.998        1.000    0.000    0.000      0.000
## 346        0.001        0.773        0.860    0.000    0.183      0.000
## 347        0.001        0.454        0.572    0.000    0.486      0.000
## 348        0.001        0.736        0.828    0.026    0.190      0.000
## 349        0.010        0.869        0.937    0.086    0.006      0.001
## 350        0.001        0.998        1.000    0.000    0.000      0.000
## 351        0.007        0.751        0.814    0.216    0.000      0.001
## 352        0.008        0.991        1.000    0.000    0.000      0.001
## 353        0.012        0.948        1.000    0.001    0.018      0.002
## 354        1.000        0.000        0.001    0.000    0.000      1.000
## 355        0.004        0.000        0.082    0.000    0.970      0.001
## 356        1.000        0.000        0.001    0.000    0.000      1.000
## 357        1.000        0.000        0.001    0.000    0.000      1.000
## 358        1.000        0.000        0.001    0.000    0.000      1.000
## 359        0.001        0.000        0.035    0.000    0.995      0.000
## 360        0.066        0.000        0.042    0.000    0.948      0.045
## 361        0.001        0.000        0.095    0.000    0.952      0.000
## 362        0.001        0.000        0.001    0.000    1.000      0.000
## 363        1.000        0.000        0.001    0.000    0.000      1.000
## 364        1.000        0.000        0.001    0.000    0.000      1.000
## 365        1.000        0.000        0.001    0.000    0.000      1.000
## 366        1.000        0.000        0.001    0.000    0.000      1.000
## 367        1.000        0.000        0.001    0.000    0.000      1.000
## 368        0.001        0.998        1.000    0.000    0.000      0.000
## 369        0.118        0.879        0.932    0.000    0.001      0.091
## 370        1.000        0.000        0.001    0.000    0.000      1.000
## 371        1.000        0.000        0.001    0.000    0.000      1.000
## 372        1.000        0.000        0.001    0.000    0.000      1.000
## 373        1.000        0.000        0.001    0.000    0.000      1.000
## 374        0.001        0.026        0.123    0.000    0.926      0.000
## 375        0.001        0.000        0.001    0.000    1.000      0.000
## 376        0.001        0.000        0.003    0.000    0.999      0.000
## 377        1.000        0.000        0.001    0.000    0.000      1.000
## 378        0.001        0.000        0.003    0.000    0.999      0.000
## 379        1.000        0.000        0.001    0.000    0.000      1.000
## 380        1.000        0.000        0.001    0.000    0.000      1.000
## 381        1.000        0.000        0.001    0.000    0.000      1.000
## 382        1.000        0.000        0.001    0.000    0.000      1.000
## 383        0.001        0.088        0.185    0.000    0.865      0.000
## 384        0.004        0.000        0.002    0.000    0.999      0.001
## 385        0.001        0.000        0.003    0.000    0.999      0.000
## 386        0.001        0.000        0.006    0.000    0.999      0.000
## 387        1.000        0.000        0.001    0.000    0.000      1.000
## 388        1.000        0.000        0.001    0.000    0.000      1.000
## 389        1.000        0.000        0.001    0.000    0.000      1.000
## 390        1.000        0.000        0.001    0.000    0.000      1.000
## 391        0.001        0.999        1.000    0.000    0.000      0.000
## 392        0.001        0.279        0.396    0.000    0.662      0.000
## 393        1.000        0.000        0.001    0.000    0.000      1.000
## 394        1.000        0.000        0.001    0.000    0.000      1.000
## 395        0.001        0.512        0.633    0.000    0.427      0.000
## 396        0.001        0.467        0.587    0.000    0.473      0.000
## 397        0.996        0.000        0.019    0.001    0.006      0.987
## 398        1.000        0.000        0.001    0.000    0.000      1.000
## 399        0.001        0.979        1.000    0.000    0.003      0.000
## 400        0.001        0.810        0.898    0.002    0.142      0.000
## 401        0.001        0.998        1.000    0.000    0.000      0.000
## 402        1.000        0.000        0.001    0.000    0.000      1.000
## 403        0.001        0.387        0.507    0.000    0.553      0.000
## 404        1.000        0.000        0.010    0.000    0.000      0.997
## 405        1.000        0.000        0.002    0.000    0.000      1.000
## 406        1.000        0.000        0.001    0.000    0.000      1.000
## 407        0.983        0.016        0.038    0.000    0.000      0.973
## 408        0.999        0.000        0.019    0.000    0.000      0.990
## 409        1.000        0.000        0.001    0.000    0.000      1.000
## 410        1.000        0.000        0.001    0.000    0.000      1.000
## 411        1.000        0.000        0.001    0.000    0.000      1.000
## 412        1.000        0.000        0.001    0.000    0.000      1.000
## 413        1.000        0.000        0.001    0.000    0.000      1.000
## 414        1.000        0.000        0.001    0.000    0.000      1.000
## 415        1.000        0.000        0.001    0.000    0.000      1.000
## 416        1.000        0.000        0.001    0.000    0.000      1.000
## 417        1.000        0.000        0.001    0.000    0.000      1.000
## 418        1.000        0.000        0.001    0.000    0.000      1.000
## 419        1.000        0.000        0.001    0.000    0.000      1.000
## 420        1.000        0.000        0.001    0.000    0.000      1.000
## 421        1.000        0.000        0.001    0.000    0.000      1.000
## 422        1.000        0.000        0.001    0.000    0.000      1.000
## 423        1.000        0.000        0.001    0.000    0.000      1.000
## 424        1.000        0.000        0.001    0.000    0.000      1.000
## 425        1.000        0.000        0.001    0.000    0.000      1.000
## 426        1.000        0.000        0.001    0.000    0.000      1.000
## 427        1.000        0.000        0.001    0.000    0.000      1.000
## 428        0.001        0.985        1.000    0.001    0.002      0.000
## 429        0.001        0.998        1.000    0.000    0.000      0.000
## 430        0.001        0.999        1.000    0.000    0.000      0.000
## 431        0.001        0.998        1.000    0.000    0.000      0.000
## 432        0.001        0.984        1.000    0.003    0.000      0.000
## 433        0.001        0.999        1.000    0.000    0.000      0.000
## 434        0.001        0.999        1.000    0.000    0.000      0.000
## 435        0.001        0.998        1.000    0.000    0.000      0.000
## 436        0.001        0.998        1.000    0.000    0.000      0.000
## 437        0.001        0.999        1.000    0.000    0.000      0.000
## 438        0.001        0.999        1.000    0.000    0.000      0.000
## 439        0.001        0.999        1.000    0.000    0.000      0.000
## 440        0.001        0.999        1.000    0.000    0.000      0.000
## 441        0.001        0.999        1.000    0.000    0.000      0.000
## 442        0.001        0.999        1.000    0.000    0.000      0.000
## 443        0.001        0.998        1.000    0.000    0.000      0.000
## 444        0.001        0.998        1.000    0.000    0.000      0.000
## 445        0.001        0.999        1.000    0.000    0.000      0.000
## 446        0.001        0.995        1.000    0.000    0.001      0.000
## 447        0.001        0.999        1.000    0.000    0.000      0.000
## 448        0.001        0.999        1.000    0.000    0.000      0.000
## 449        0.001        0.998        1.000    0.000    0.000      0.000
## 450        0.001        0.999        1.000    0.000    0.000      0.000
## 451        0.001        0.998        1.000    0.000    0.000      0.000
## 452        0.001        0.999        1.000    0.000    0.000      0.000
## 453        0.001        0.999        1.000    0.000    0.000      0.000
## 454        0.001        0.995        1.000    0.000    0.000      0.000
## 455        0.001        0.998        1.000    0.000    0.000      0.000
## 456        0.001        0.999        1.000    0.000    0.000      0.000
## 457        0.001        0.999        1.000    0.000    0.000      0.000
## 458        0.001        0.999        1.000    0.000    0.000      0.000
## 459        0.001        0.998        1.000    0.000    0.000      0.000
## 460        0.001        0.999        1.000    0.000    0.000      0.000
## 461        0.001        0.997        1.000    0.000    0.000      0.000
## 462        0.001        0.999        1.000    0.000    0.000      0.000
## 463        0.001        0.999        1.000    0.000    0.000      0.000
## 464        0.001        0.999        1.000    0.000    0.000      0.000
## 465        0.001        0.999        1.000    0.000    0.000      0.000
## 466        0.001        0.997        1.000    0.000    0.000      0.000
## 467        0.001        0.998        1.000    0.000    0.000      0.000
## 468        0.001        0.999        1.000    0.000    0.000      0.000
## 469        0.001        0.998        1.000    0.000    0.000      0.000
## 470        0.001        0.999        1.000    0.000    0.000      0.000
## 471        0.001        0.999        1.000    0.000    0.000      0.000
## 472        0.002        0.994        1.000    0.000    0.000      0.000
## 473        0.001        0.998        1.000    0.000    0.000      0.000
## 474        0.001        0.986        1.000    0.000    0.002      0.000
## 475        0.001        0.999        1.000    0.000    0.000      0.000
## 476        0.001        0.999        1.000    0.000    0.000      0.000
## 477        0.001        0.998        1.000    0.000    0.000      0.000
## 478        0.007        0.990        1.000    0.000    0.001      0.001
## 479        0.002        0.996        1.000    0.000    0.000      0.000
## 480        0.001        0.999        1.000    0.000    0.000      0.000
## 481        0.001        0.999        1.000    0.000    0.000      0.000
## 482        0.001        0.998        1.000    0.000    0.000      0.000
## 483        0.001        0.999        1.000    0.000    0.000      0.000
## 484        0.001        0.999        1.000    0.000    0.000      0.000
## 485        0.001        0.999        1.000    0.000    0.000      0.000
## 486        0.014        0.985        1.000    0.000    0.000      0.003
## 487        0.001        0.996        1.000    0.000    0.000      0.000
## 488        0.001        0.998        1.000    0.000    0.000      0.000
## 489        0.001        0.998        1.000    0.000    0.000      0.000
## 490        0.001        0.999        1.000    0.000    0.000      0.000
## 491        0.001        0.999        1.000    0.000    0.000      0.000
## 492        0.007        0.990        1.000    0.000    0.001      0.001
## 493        0.011        0.989        1.000    0.000    0.000      0.002
## 494        0.001        0.999        1.000    0.000    0.000      0.000
## 495        0.039        0.961        0.987    0.000    0.000      0.025
## 496        0.001        0.999        1.000    0.000    0.000      0.000
## 497        0.001        0.999        1.000    0.000    0.000      0.000
## 498        0.001        0.999        1.000    0.000    0.000      0.000
## 499        0.120        0.880        0.929    0.000    0.000      0.094
## 500        0.001        0.997        1.000    0.000    0.000      0.000
## 501        0.001        0.998        1.000    0.000    0.000      0.000
## 502        0.001        0.000        0.001    0.000    1.000      0.000
## 503        0.001        0.000        0.001    0.000    1.000      0.000
## 504        0.001        0.000        0.002    0.000    1.000      0.000
## 505        0.001        0.000        0.009    0.000    0.999      0.000
## 506        0.001        0.000        0.001    0.000    1.000      0.000
## 507        0.001        0.000        0.066    0.000    0.982      0.000
## 508        0.001        0.000        0.002    0.000    1.000      0.000
## 509        0.001        0.000        0.001    0.000    1.000      0.000
## 510        0.001        0.000        0.001    0.000    1.000      0.000
## 511        0.001        0.000        0.014    0.000    0.998      0.000
## 512        0.001        0.000        0.037    0.000    0.994      0.000
## 513        0.001        0.000        0.002    0.000    1.000      0.000
## 514        0.001        0.000        0.002    0.000    1.000      0.000
## 515        0.007        0.000        0.001    0.000    0.999      0.001
## 516        0.001        0.999        1.000    0.000    0.000      0.000
## 517        0.001        0.993        1.000    0.000    0.001      0.000
## 518        0.001        0.998        1.000    0.000    0.000      0.000
## 519        0.001        0.999        1.000    0.000    0.000      0.000
## 520        0.001        0.999        1.000    0.000    0.000      0.000
## 521        0.001        0.998        1.000    0.000    0.000      0.000
## 522        0.001        0.999        1.000    0.000    0.000      0.000
## 523        0.001        0.999        1.000    0.000    0.000      0.000
## 524        0.001        0.999        1.000    0.000    0.000      0.000
## 525        0.011        0.983        1.000    0.000    0.002      0.002
## 526        0.001        0.999        1.000    0.000    0.000      0.000
## 527        0.001        0.998        1.000    0.000    0.000      0.000
## 528        0.001        0.988        1.000    0.000    0.001      0.000
## 529        0.001        0.999        1.000    0.000    0.000      0.000
## 530        0.001        0.998        1.000    0.000    0.000      0.000
## 531        0.001        0.999        1.000    0.000    0.000      0.000
## 532        0.001        0.999        1.000    0.000    0.000      0.000
## 533        0.001        0.999        1.000    0.000    0.000      0.000
## 534        0.001        0.999        1.000    0.000    0.000      0.000
## 535        0.009        0.990        1.000    0.000    0.000      0.001
## 536        0.001        0.999        1.000    0.000    0.000      0.000
## 537        0.001        0.999        1.000    0.000    0.000      0.000
## 538        0.001        0.999        1.000    0.000    0.000      0.000
## 539        0.001        0.999        1.000    0.000    0.000      0.000
## 540        0.001        0.998        1.000    0.000    0.000      0.000
## 541        0.001        0.998        1.000    0.000    0.000      0.000
## 542        0.001        0.999        1.000    0.000    0.000      0.000
## 543        0.001        0.998        1.000    0.000    0.000      0.000
## 544        0.001        0.999        1.000    0.000    0.000      0.000
## 545        0.005        0.994        1.000    0.000    0.000      0.001
## 546        0.001        0.999        1.000    0.000    0.000      0.000
## 547        0.001        0.998        1.000    0.000    0.000      0.000
## 548        0.001        0.998        1.000    0.000    0.000      0.000
## 549        0.001        0.999        1.000    0.000    0.000      0.000
## 550        0.001        0.999        1.000    0.000    0.000      0.000
## 551        0.001        0.999        1.000    0.000    0.000      0.000
## 552        0.001        0.999        1.000    0.000    0.000      0.000
## 553        0.001        0.999        1.000    0.000    0.000      0.000
##     sublineata      popID
## 1        0.000       38CR
## 2        0.000       41CR
## 3        0.000       41CR
## 4        0.006       41CR
## 5        0.000       41CR
## 6        0.000       43GR
## 7        0.000       43GR
## 8        0.000       43GR
## 9        0.000       38CR
## 10       0.000       43GR
## 11       0.000       44GR
## 12       0.000       44GR
## 13       0.000       44GR
## 14       0.000       44GR
## 15       0.000       44GR
## 16       0.000       38CR
## 17       0.000       43GR
## 18       0.000       43GR
## 19       0.000       43GR
## 20       0.000       44GR
## 21       0.000       44GR
## 22       0.000       44GR
## 23       0.000       38CR
## 24       0.000       44GR
## 25       0.000       41CR
## 26       0.000       41CR
## 27       0.000       41CR
## 28       0.000       41CR
## 29       0.000       37CR
## 30       0.000       37CR
## 31       0.000       37CR
## 32       0.000       38CR
## 33       0.000       39CR
## 34       0.000       38CR
## 35       0.000       38CR
## 36       0.000       38CR
## 37       0.000       39CR
## 38       0.000       39CR
## 39       0.000       39CR
## 40       0.000       39CR
## 41       0.000       41CR
## 42       0.000       41CR
## 43       0.000       41CR
## 44       0.000       39CR
## 45       0.000       41CR
## 46       0.000       43GR
## 47       0.000       43GR
## 48       0.000       43GR
## 49       0.000       43GR
## 50       0.001       44GR
## 51       0.000       39CR
## 52       0.000       37CR
## 53       0.000       37CR
## 54       0.000       37CR
## 55       0.000       38CR
## 56       0.000       38CR
## 57       0.000       38CR
## 58       0.000       39CR
## 59       0.000       39CR
## 60       0.000       39CR
## 61       0.000       39CR
## 62       0.000       39CR
## 63       0.000       41CR
## 64       0.000       41CR
## 65       0.000       41CR
## 66       0.000       41CR
## 67       0.000       43GR
## 68       0.000       43GR
## 69       0.000       43GR
## 70       0.000       43GR
## 71       0.000       44GR
## 72       0.000       44GR
## 73       0.000       44GR
## 74       0.000       44GR
## 75       0.000       44GR
## 76       0.000       44GR
## 77       0.000        1WY
## 78       0.000       32UT
## 79       0.000       32UT
## 80       0.000       32UT
## 81       0.000        1WY
## 82       0.000        1WY
## 83       0.000       34UT
## 84       0.000       34UT
## 85       0.000       34UT
## 86       0.000       34UT
## 87       0.000       32UT
## 88       0.000       32UT
## 89       0.000       32UT
## 90       0.000       32UT
## 91       0.000        1WY
## 92       0.000        1WY
## 93       0.000        1WY
## 94       0.000        1WY
## 95       0.000       15TX
## 96       0.000        1WY
## 97       0.001       15TX
## 98       0.000       32UT
## 99       0.000       32UT
## 100      0.000       32UT
## 101      0.000       32UT
## 102      0.000        1WY
## 103      0.000        1WY
## 104      0.000        1WY
## 105      0.000        1WY
## 106      0.000       34UT
## 107      0.000        1WY
## 108      0.000       34UT
## 109      0.000       34UT
## 110      0.000       34UT
## 111      0.000       32UT
## 112      0.000       32UT
## 113      0.000       32UT
## 114      0.000       32UT
## 115      0.000        1WY
## 116      0.000        1WY
## 117      0.000        1WY
## 118      0.000       34UT
## 119      0.000        1WY
## 120      0.000       34UT
## 121      0.000       34UT
## 122      0.000       34UT
## 123      0.000       34UT
## 124      0.000       32UT
## 125      0.000       32UT
## 126      0.000       32UT
## 127      0.000       32UT
## 128      0.000       12AZ
## 129      0.000       12AZ
## 130      0.000       33NV
## 131      0.000       33NV
## 132      0.000       33NV
## 133      0.000       33NV
## 134      0.000       12AZ
## 135      0.000       12AZ
## 136      0.000       12AZ
## 137      0.000       11CO
## 138      0.000       34UT
## 139      0.000       11CO
## 140      0.000       33NV
## 141      0.000       33NV
## 142      0.000       12AZ
## 143      0.000       12AZ
## 144      0.000       34UT
## 145      0.000       11CO
## 146      0.000       11CO
## 147      0.000       33NV
## 148      0.000       33NV
## 149      0.000       33NV
## 150      0.000       32UT
## 151      0.000       34UT
## 152      0.000       11CO
## 153      0.000       11CO
## 154      0.000       31NV
## 155      0.000       31NV
## 156      0.000       11CO
## 157      0.000       31NV
## 158      0.000       31NV
## 159      0.000       31NV
## 160      0.000       31NV
## 161      0.000       12AZ
## 162      0.000       12AZ
## 163      0.000       12AZ
## 164      0.000       12AZ
## 165      0.001       11CO
## 166      0.000       31NV
## 167      0.000       11CO
## 168      0.000       11CO
## 169      0.000       11CO
## 170      0.000       12AZ
## 171      0.000       12AZ
## 172      0.000        5CO
## 173      0.000        5CO
## 174      0.000        5CO
## 175      0.000        5CO
## 176      0.000        6KS
## 177      0.000        6KS
## 178      0.013        8OK
## 179      0.000        8OK
## 180      0.000        8OK
## 181      0.000        8OK
## 182      0.000        5CO
## 183      0.000        5CO
## 184      0.000        5CO
## 185      0.000       12AZ
## 186      0.030        6KS
## 187      0.001        6KS
## 188      0.000        6KS
## 189      0.000        6KS
## 190      0.000        8OK
## 191      0.002        8OK
## 192      0.001        8OK
## 193      0.001        8OK
## 194      0.000        5CO
## 195      0.000       12AZ
## 196      0.000        5CO
## 197      0.001        5CO
## 198      0.000        5CO
## 199      0.000       16TX
## 200      0.000        8OK
## 201      0.000        8OK
## 202      0.000        8OK
## 203      0.000        8OK
## 204      0.000        5CO
## 205      0.000        5CO
## 206      0.000        5CO
## 207      0.000        5CO
## 208      0.000        6KS
## 209      0.005        6KS
## 210      0.000       16TX
## 211      0.000       16TX
## 212      0.000        8OK
## 213      0.001        8OK
## 214      0.000        8OK
## 215      0.000        8OK
## 216      0.000        5CO
## 217      0.000        5CO
## 218      0.000        5CO
## 219      0.000        5CO
## 220      1.000       27NM
## 221      1.000       27NM
## 222      1.000       27NM
## 223      0.904       27NM
## 224      0.001        8OK
## 225      0.001        8OK
## 226      0.000        8OK
## 227      0.000        8OK
## 228      0.999       26NM
## 229      0.876       26NM
## 230      0.000       15TX
## 231      0.000       15TX
## 232      0.003       15TX
## 233      0.000       15TX
## 234      0.012       28NM
## 235      0.000       11CO
## 236      0.001       28NM
## 237      0.000       28NM
## 238      0.520       28NM
## 239      0.999       26NM
## 240      0.819       26NM
## 241      0.913       26NM
## 242      0.672       26NM
## 243      0.000       15TX
## 244      0.927       26NM
## 245      0.888       26NM
## 246      0.970       26NM
## 247      0.000       16TX
## 248      0.000       16TX
## 249      0.000       16TX
## 250      0.001       16TX
## 251      0.000       28NM
## 252      0.000       28NM
## 253      0.638       27NM
## 254      0.181       15TX
## 255      1.000       27NM
## 256      0.967       27NM
## 257      0.950       27NM
## 258      0.996       20NM
## 259      1.000       20NM
## 260      1.000       20NM
## 261      1.000       20NM
## 262      1.000       27NM
## 263      0.959       27NM
## 264      0.984       27NM
## 265      0.003       16TX
## 266      1.000       27NM
## 267      1.000       21NM
## 268      1.000       21NM
## 269      0.999       21NM
## 270      0.998       21NM
## 271      0.905       20NM
## 272      1.000       20NM
## 273      1.000       20NM
## 274      0.386       20NM
## 275      0.949       21NM
## 276      0.000       16TX
## 277      0.945       21NM
## 278      0.996       21NM
## 279      1.000       21NM
## 280      0.000       15TX
## 281      0.000       15TX
## 282      0.001       15TX
## 283      0.000       15TX
## 284      0.000        6KS
## 285      0.909        6KS
## 286      0.998       20NM
## 287      0.003       28NM
## 288      0.916       20NM
## 289      0.745       20NM
## 290      1.000       18TX
## 291      1.000       18TX
## 292      0.996       18TX
## 293      1.000       18TX
## 294      0.000       16TX
## 295      0.000       16TX
## 296      0.002       16TX
## 297      0.918       28NM
## 298      0.000       16TX
## 299      1.000       20NM
## 300      1.000       20NM
## 301      0.835       20NM
## 302      0.990       20NM
## 303      1.000       18TX
## 304      1.000       18TX
## 305      0.999       18TX
## 306      1.000       18TX
## 307      0.997       20NM
## 308      0.000       28NM
## 309      1.000       20NM
## 310      0.951       18TX
## 311      1.000       18TX
## 312      0.000       16TX
## 313      0.000       16TX
## 314      0.000       16TX
## 315      0.000       16TX
## 316      0.125       16TX
## 317      0.999       27NM
## 318      0.000       28NM
## 319      0.975       27NM
## 320      0.968       27NM
## 321      1.000       27NM
## 322      0.741       21NM
## 323      0.992       21NM
## 324      0.000       15TX
## 325      0.000       15TX
## 326      0.000       15TX
## 327      0.001       15TX
## 328      0.000        2CO
## 329      0.792       26NM
## 330      0.000        2CO
## 331      0.000        2CO
## 332      1.000       18TX
## 333      0.003       19TX
## 334      0.244       28NM
## 335      0.088       28NM
## 336      0.758       26NM
## 337      0.000        2CO
## 338      0.000        2CO
## 339      0.000        2CO
## 340      0.000        2CO
## 341      0.918       27NM
## 342      0.985       27NM
## 343      0.925       27NM
## 344      0.081       19TX
## 345      1.000       27NM
## 346      0.817       26NM
## 347      0.514       26NM
## 348      0.783       26NM
## 349      0.907       26NM
## 350      1.000       21NM
## 351      0.783       21NM
## 352      0.999       21NM
## 353      0.979       21NM
## 354      0.000        2CO
## 355      0.029       19TX
## 356      0.000        2CO
## 357      0.000        2CO
## 358      0.000        2CO
## 359      0.005       19TX
## 360      0.007       19TX
## 361      0.048       19TX
## 362      0.000       19TX
## 363      0.000        4CO
## 364      0.000        4CO
## 365      0.000        4CO
## 366      0.000        2CO
## 367      0.000        4CO
## 368      1.000       18TX
## 369      0.907       18TX
## 370      0.000        2CO
## 371      0.000        2CO
## 372      0.000        2CO
## 373      0.000        2CO
## 374      0.074       19TX
## 375      0.000       19TX
## 376      0.001       19TX
## 377      0.000        2CO
## 378      0.000       19TX
## 379      0.000        4CO
## 380      0.000        4CO
## 381      0.000        4CO
## 382      0.000        4CO
## 383      0.135       19TX
## 384      0.000       19TX
## 385      0.000       19TX
## 386      0.001       19TX
## 387      0.000        4CO
## 388      0.000        2CO
## 389      0.000        4CO
## 390      0.000        4CO
## 391      1.000       18TX
## 392      0.338       18TX
## 393      0.000       18TX
## 394      0.000       18TX
## 395      0.573       28NM
## 396      0.527       28NM
## 397      0.006       28NM
## 398      0.000        2CO
## 399      0.996       26NM
## 400      0.856       26NM
## 401      1.000       26NM
## 402      0.000       28NM
## 403      0.447       28NM
## 404      0.002       46CH
## 405      0.000       46CH
## 406      0.000       46CH
## 407      0.026       46CH
## 408      0.009       46CH
## 409      0.000       46CH
## 410      0.000       46CH
## 411      0.000       46CH
## 412      0.000       46CH
## 413      0.000       46CH
## 414      0.000       46CH
## 415      0.000       46CH
## 416      0.000       46CH
## 417      0.000       46CH
## 418      0.000       46CH
## 419      0.000       46CH
## 420      0.000       46CH
## 421      0.000       46CH
## 422      0.000       46CH
## 423      0.000       46CH
## 424      0.000       46CH
## 425      0.000       46CH
## 426      0.000       46CH
## 427      0.000       46CH
## 428      0.997       51TX
## 429      1.000       51TX
## 430      1.000       51TX
## 431      1.000       51TX
## 432      0.997       51TX
## 433      1.000       51TX
## 434      1.000       51TX
## 435      1.000       51TX
## 436      1.000       51TX
## 437      1.000       51TX
## 438      1.000       51TX
## 439      1.000       51TX
## 440      1.000       51TX
## 441      1.000       51TX
## 442      1.000       50TX
## 443      1.000       50TX
## 444      1.000       50TX
## 445      1.000       50TX
## 446      0.999       50TX
## 447      1.000       50TX
## 448      1.000       50TX
## 449      1.000       50TX
## 450      1.000       49TX
## 451      1.000       49TX
## 452      1.000       49TX
## 453      1.000       49TX
## 454      0.999       49TX
## 455      1.000       49TX
## 456      1.000       49TX
## 457      1.000       49TX
## 458      1.000       49TX
## 459      1.000       49TX
## 460      1.000       49TX
## 461      0.999       49TX
## 462      1.000       49TX
## 463      1.000       49TX
## 464      1.000       49TX
## 465      1.000       49TX
## 466      1.000       49TX
## 467      1.000       49TX
## 468      1.000       49TX
## 469      1.000       49TX
## 470      1.000       49TX
## 471      1.000       49TX
## 472      0.999       49TX
## 473      1.000       49TX
## 474      0.998       49TX
## 475      1.000       49TX
## 476      1.000       49TX
## 477      1.000       47TX
## 478      0.998       47TX
## 479      0.999       47TX
## 480      1.000       47TX
## 481      1.000       47TX
## 482      1.000       47TX
## 483      1.000       47TX
## 484      1.000       47TX
## 485      1.000       47TX
## 486      0.997       47TX
## 487      0.999       47TX
## 488      1.000       47TX
## 489      1.000       47TX
## 490      1.000       47TX
## 491      1.000       47TX
## 492      0.998       47TX
## 493      0.998       47TX
## 494      1.000       47TX
## 495      0.975       47TX
## 496      1.000       47TX
## 497      1.000       47TX
## 498      1.000       47TX
## 499      0.905       47TX
## 500      1.000       47TX
## 501      1.000       47TX
## 502      0.000 CARINA_LAB
## 503      0.000 CARINA_LAB
## 504      0.000 CARINA_LAB
## 505      0.001 CARINA_LAB
## 506      0.000 CARINA_LAB
## 507      0.018 CARINA_LAB
## 508      0.000 CARINA_LAB
## 509      0.000 CARINA_LAB
## 510      0.000 CARINA_LAB
## 511      0.002 CARINA_LAB
## 512      0.006 CARINA_LAB
## 513      0.000 CARINA_LAB
## 514      0.000 CARINA_LAB
## 515      0.000 CARINA_LAB
## 516      1.000    SUB_LAB
## 517      0.999    SUB_LAB
## 518      1.000    SUB_LAB
## 519      1.000    SUB_LAB
## 520      1.000    SUB_LAB
## 521      1.000    SUB_LAB
## 522      1.000    SUB_LAB
## 523      1.000    SUB_LAB
## 524      1.000    SUB_LAB
## 525      0.996    SUB_LAB
## 526      1.000    SUB_LAB
## 527      1.000    SUB_LAB
## 528      0.998    SUB_LAB
## 529      1.000    SUB_LAB
## 530      1.000    SUB_LAB
## 531      1.000    SUB_LAB
## 532      1.000    SUB_LAB
## 533      1.000       52TX
## 534      1.000       52TX
## 535      0.998       52TX
## 536      1.000       52TX
## 537      1.000       52TX
## 538      1.000       52TX
## 539      1.000       52TX
## 540      1.000       52TX
## 541      1.000       52TX
## 542      1.000       52TX
## 543      1.000       52TX
## 544      1.000       52TX
## 545      0.999       52TX
## 546      1.000       52TX
## 547      1.000       52TX
## 548      1.000       52TX
## 549      1.000       52TX
## 550      1.000       52TX
## 551      1.000       52TX
## 552      1.000       52TX
## 553      1.000       52TX
write.csv(ci,"ancestry_confidenceintervals.csv",
          quote = FALSE)

library(tibble)  # for `rownames_to_column` and `column_to_rownames`
## Warning: package 'tibble' was built under R version 3.5.2
colnames(ci)
##  [1] "sampID"       "elongata_L"   "elongata_H"   "carinata_L"  
##  [5] "carinata_H"   "carinulata_L" "carinulata_H" "sublineata_L"
##  [9] "sublineata_H" "elongata"     "carinata"     "carinulata"  
## [13] "sublineata"   "popID"
## How many tri-specific hybrids? 
ci %>%
  rownames_to_column('individual') %>%
  filter(carinata_L >.01 & elongata_L> .01 & sublineata_L > .01) %>%
  arrange(desc(elongata_L))
##   individual sampID elongata_L elongata_H carinata_L carinata_H
## 1        229    F84      0.022      0.055      0.050      0.128
## 2        254     G2      0.019      0.053      0.733      0.832
## 3        348    H23      0.012      0.043      0.144      0.239
##   carinulata_L carinulata_H sublineata_L sublineata_H elongata carinata
## 1            0        0.001        0.837        0.911    0.037    0.087
## 2            0        0.001        0.135        0.230    0.035    0.784
## 3            0        0.001        0.736        0.828    0.026    0.190
##   carinulata sublineata popID
## 1          0      0.876  26NM
## 2          0      0.181  15TX
## 3          0      0.783  26NM
ci %>%
  rownames_to_column('individual') %>%
  filter(carinata >.01 & elongata > .01 & sublineata > .01) %>%
  arrange(desc(elongata))
##   individual sampID elongata_L elongata_H carinata_L carinata_H
## 1        229    F84      0.022      0.055      0.050      0.128
## 2        254     G2      0.019      0.053      0.733      0.832
## 3        240    F94      0.000      0.054      0.099      0.202
## 4        348    H23      0.012      0.043      0.144      0.239
## 5        223    F78      0.005      0.044      0.036      0.110
## 6        341    H17      0.000      0.045      0.000      0.112
## 7        334    H10      0.000      0.048      0.626      0.755
##   carinulata_L carinulata_H sublineata_L sublineata_H elongata carinata
## 1        0.000        0.001        0.837        0.911    0.037    0.087
## 2        0.000        0.001        0.135        0.230    0.035    0.784
## 3        0.000        0.019        0.768        0.865    0.031    0.148
## 4        0.000        0.001        0.736        0.828    0.026    0.190
## 5        0.000        0.001        0.869        0.935    0.025    0.071
## 6        0.000        0.001        0.877        0.958    0.019    0.063
## 7        0.027        0.073        0.183        0.307    0.014    0.692
##   carinulata sublineata popID
## 1      0.000      0.876  26NM
## 2      0.000      0.181  15TX
## 3      0.003      0.819  26NM
## 4      0.000      0.783  26NM
## 5      0.000      0.904  27NM
## 6      0.000      0.918  27NM
## 7      0.050      0.244  28NM
## How many hybrids with carinulata?
ci %>%
  rownames_to_column('individual') %>%
  filter(carinulata_L >.01) %>%
  filter(elongata_L> .01 | 
           sublineata_L > .01 | carinata_L > .01) %>%
  arrange(desc(carinulata_L))
##    individual  sampID elongata_L elongata_H carinata_L carinata_H
## 1         407     I04      0.000      0.001      0.000      0.002
## 2         335 H11_rep      0.000      0.024      0.000      0.001
## 3         287  G5_rep      0.000      0.001      0.311      0.378
## 4          52 D70_rep      0.860      0.909      0.000      0.001
## 5         285 G48_rep      0.000      0.001      0.000      0.001
## 6         499      N7      0.000      0.001      0.000      0.001
## 7         369     H42      0.000      0.001      0.000      0.005
## 8           4 D15_rep      0.914      0.956      0.000      0.001
## 9          14 D24_rep      0.921      0.962      0.000      0.001
## 10        310     G71      0.000      0.001      0.000      0.001
## 11        344      H2      0.000      0.001      0.817      0.914
## 12        334     H10      0.000      0.048      0.626      0.755
## 13        360     H34      0.000      0.001      0.911      0.971
## 14        333      H1      0.000      0.005      0.946      0.985
## 15        495      N3      0.000      0.001      0.000      0.001
##    carinulata_L carinulata_H sublineata_L sublineata_H elongata carinata
## 1         0.962        0.983        0.016        0.038    0.000    0.000
## 2         0.888        0.926        0.066        0.109    0.004    0.000
## 3         0.621        0.683        0.000        0.023    0.000    0.345
## 4         0.090        0.139        0.000        0.002    0.885    0.000
## 5         0.071        0.112        0.888        0.929    0.000    0.000
## 6         0.071        0.120        0.880        0.929    0.000    0.000
## 7         0.067        0.118        0.879        0.932    0.000    0.001
## 8         0.039        0.078        0.000        0.028    0.936    0.000
## 9         0.038        0.079        0.000        0.001    0.942    0.000
## 10        0.033        0.066        0.934        0.967    0.000    0.000
## 11        0.033        0.076        0.032        0.130    0.000    0.866
## 12        0.027        0.073        0.183        0.307    0.014    0.692
## 13        0.027        0.066        0.000        0.042    0.000    0.948
## 14        0.013        0.047        0.000        0.019    0.001    0.967
## 15        0.012        0.039        0.961        0.987    0.000    0.000
##    carinulata sublineata popID
## 1       0.973      0.026  46CH
## 2       0.908      0.088  28NM
## 3       0.652      0.003  28NM
## 4       0.114      0.000  37CR
## 5       0.091      0.909   6KS
## 6       0.094      0.905  47TX
## 7       0.091      0.907  18TX
## 8       0.058      0.006  41CR
## 9       0.058      0.000  44GR
## 10      0.049      0.951  18TX
## 11      0.054      0.081  19TX
## 12      0.050      0.244  28NM
## 13      0.045      0.007  19TX
## 14      0.029      0.003  19TX
## 15      0.025      0.975  47TX
ci %>%
  rownames_to_column('individual') %>%
  filter(carinulata_H >.1) %>%
  filter(elongata_L> .01 | 
           sublineata_L > .01 | carinata_L > .01) %>%
  arrange(desc(carinulata_L))
##   individual  sampID elongata_L elongata_H carinata_L carinata_H
## 1        407     I04       0.00      0.001      0.000      0.002
## 2        335 H11_rep       0.00      0.024      0.000      0.001
## 3        287  G5_rep       0.00      0.001      0.311      0.378
## 4         52 D70_rep       0.86      0.909      0.000      0.001
## 5        285 G48_rep       0.00      0.001      0.000      0.001
## 6        499      N7       0.00      0.001      0.000      0.001
## 7        369     H42       0.00      0.001      0.000      0.005
##   carinulata_L carinulata_H sublineata_L sublineata_H elongata carinata
## 1        0.962        0.983        0.016        0.038    0.000    0.000
## 2        0.888        0.926        0.066        0.109    0.004    0.000
## 3        0.621        0.683        0.000        0.023    0.000    0.345
## 4        0.090        0.139        0.000        0.002    0.885    0.000
## 5        0.071        0.112        0.888        0.929    0.000    0.000
## 6        0.071        0.120        0.880        0.929    0.000    0.000
## 7        0.067        0.118        0.879        0.932    0.000    0.001
##   carinulata sublineata popID
## 1      0.973      0.026  46CH
## 2      0.908      0.088  28NM
## 3      0.652      0.003  28NM
## 4      0.114      0.000  37CR
## 5      0.091      0.909   6KS
## 6      0.094      0.905  47TX
## 7      0.091      0.907  18TX
## How many hybrids with sublineata?
ci %>%
  rownames_to_column('individual') %>%
  filter(sublineata_L >.01) %>%
  filter(carinulata_L > .01 | 
           elongata_L > .01 | carinata_L > .01) %>%
  arrange(desc(sublineata_L))
##    individual  sampID elongata_L elongata_H carinata_L carinata_H
## 1         495      N3      0.000      0.001      0.000      0.001
## 2         246     G12      0.018      0.043      0.000      0.001
## 3         256     G21      0.020      0.048      0.000      0.001
## 4         320     G81      0.000      0.001      0.011      0.056
## 5         263     G28      0.027      0.057      0.000      0.001
## 6         310     G71      0.000      0.001      0.000      0.001
## 7         257     G22      0.034      0.068      0.000      0.001
## 8         275     G39      0.028      0.070      0.000      0.023
## 9         277     G40      0.000      0.001      0.027      0.087
## 10        244     G10      0.055      0.091      0.000      0.001
## 11        288     G50      0.065      0.105      0.000      0.001
## 12        343     H19      0.000      0.001      0.047      0.106
## 13        285 G48_rep      0.000      0.001      0.000      0.001
## 14        297      G6      0.000      0.001      0.053      0.114
## 15        499      N7      0.000      0.001      0.000      0.001
## 16        369     H42      0.000      0.001      0.000      0.005
## 17        241     F95      0.000      0.001      0.054      0.126
## 18        223     F78      0.005      0.044      0.036      0.110
## 19        349     H24      0.057      0.118      0.000      0.041
## 20        271     G35      0.000      0.001      0.053      0.143
## 21        245     G11      0.000      0.001      0.073      0.156
## 22        229     F84      0.022      0.055      0.050      0.128
## 23        400     H71      0.000      0.016      0.099      0.188
## 24        301     G63      0.000      0.009      0.121      0.209
## 25        346     H21      0.000      0.001      0.140      0.227
## 26        240     F94      0.000      0.054      0.099      0.202
## 27        351     H26      0.185      0.248      0.000      0.001
## 28        329      G9      0.000      0.001      0.163      0.256
## 29        348     H23      0.012      0.043      0.144      0.239
## 30        336     H12      0.000      0.001      0.195      0.294
## 31        289     G52      0.000      0.001      0.207      0.304
## 32        322     G83      0.000      0.001      0.193      0.329
## 33        242     F96      0.000      0.015      0.269      0.384
## 34        253     G19      0.000      0.002      0.301      0.425
## 35        395     H67      0.000      0.001      0.367      0.488
## 36        396     H68      0.000      0.001      0.413      0.533
## 37        238     F92      0.000      0.001      0.419      0.541
## 38        347     H22      0.000      0.002      0.427      0.545
## 39        403      H9      0.000      0.001      0.492      0.613
## 40        274     G38      0.000      0.001      0.554      0.673
## 41        392     H64      0.000      0.001      0.604      0.721
## 42        334     H10      0.000      0.048      0.626      0.755
## 43        254      G2      0.019      0.053      0.733      0.832
## 44        383     H55      0.000      0.001      0.815      0.911
## 45        316     G78      0.000      0.001      0.827      0.918
## 46        335 H11_rep      0.000      0.024      0.000      0.001
## 47        344      H2      0.000      0.001      0.817      0.914
## 48        374     H47      0.000      0.001      0.876      0.974
## 49        407     I04      0.000      0.001      0.000      0.002
##    carinulata_L carinulata_H sublineata_L sublineata_H elongata carinata
## 1         0.012        0.039        0.961        0.987    0.000    0.000
## 2         0.000        0.001        0.957        0.982    0.029    0.000
## 3         0.000        0.001        0.952        0.980    0.033    0.000
## 4         0.000        0.001        0.944        0.989    0.000    0.032
## 5         0.000        0.001        0.943        0.973    0.041    0.000
## 6         0.033        0.066        0.934        0.967    0.000    0.000
## 7         0.000        0.001        0.932        0.966    0.050    0.000
## 8         0.000        0.002        0.924        0.969    0.048    0.003
## 9         0.000        0.001        0.913        0.973    0.000    0.055
## 10        0.000        0.001        0.909        0.945    0.072    0.000
## 11        0.000        0.001        0.895        0.935    0.084    0.000
## 12        0.000        0.001        0.893        0.953    0.000    0.075
## 13        0.071        0.112        0.888        0.929    0.000    0.000
## 14        0.000        0.001        0.886        0.947    0.000    0.082
## 15        0.071        0.120        0.880        0.929    0.000    0.000
## 16        0.067        0.118        0.879        0.932    0.000    0.001
## 17        0.000        0.001        0.874        0.946    0.000    0.087
## 18        0.000        0.001        0.869        0.935    0.025    0.071
## 19        0.000        0.010        0.869        0.937    0.086    0.006
## 20        0.000        0.001        0.857        0.947    0.000    0.094
## 21        0.000        0.001        0.843        0.927    0.000    0.112
## 22        0.000        0.001        0.837        0.911    0.037    0.087
## 23        0.000        0.001        0.810        0.898    0.002    0.142
## 24        0.000        0.001        0.790        0.877    0.001    0.164
## 25        0.000        0.001        0.773        0.860    0.000    0.183
## 26        0.000        0.019        0.768        0.865    0.031    0.148
## 27        0.000        0.007        0.751        0.814    0.216    0.000
## 28        0.000        0.001        0.744        0.837    0.000    0.208
## 29        0.000        0.001        0.736        0.828    0.026    0.190
## 30        0.000        0.001        0.706        0.805    0.000    0.242
## 31        0.000        0.001        0.696        0.793    0.000    0.254
## 32        0.000        0.001        0.671        0.806    0.000    0.259
## 33        0.000        0.001        0.615        0.729    0.002    0.326
## 34        0.000        0.001        0.575        0.699    0.000    0.362
## 35        0.000        0.001        0.512        0.633    0.000    0.427
## 36        0.000        0.001        0.467        0.587    0.000    0.473
## 37        0.000        0.001        0.459        0.581    0.000    0.480
## 38        0.000        0.001        0.454        0.572    0.000    0.486
## 39        0.000        0.001        0.387        0.507    0.000    0.553
## 40        0.000        0.001        0.327        0.446    0.000    0.614
## 41        0.000        0.001        0.279        0.396    0.000    0.662
## 42        0.027        0.073        0.183        0.307    0.014    0.692
## 43        0.000        0.001        0.135        0.230    0.035    0.784
## 44        0.000        0.001        0.088        0.185    0.000    0.865
## 45        0.000        0.001        0.082        0.172    0.000    0.875
## 46        0.888        0.926        0.066        0.109    0.004    0.000
## 47        0.033        0.076        0.032        0.130    0.000    0.866
## 48        0.000        0.001        0.026        0.123    0.000    0.926
## 49        0.962        0.983        0.016        0.038    0.000    0.000
##    carinulata sublineata popID
## 1       0.025      0.975  47TX
## 2       0.000      0.970  26NM
## 3       0.000      0.967  27NM
## 4       0.000      0.968  27NM
## 5       0.000      0.959  27NM
## 6       0.049      0.951  18TX
## 7       0.000      0.950  27NM
## 8       0.000      0.949  21NM
## 9       0.000      0.945  21NM
## 10      0.000      0.927  26NM
## 11      0.000      0.916  20NM
## 12      0.000      0.925  27NM
## 13      0.091      0.909   6KS
## 14      0.000      0.918  28NM
## 15      0.094      0.905  47TX
## 16      0.091      0.907  18TX
## 17      0.000      0.913  26NM
## 18      0.000      0.904  27NM
## 19      0.001      0.907  26NM
## 20      0.000      0.905  20NM
## 21      0.000      0.888  26NM
## 22      0.000      0.876  26NM
## 23      0.000      0.856  26NM
## 24      0.000      0.835  20NM
## 25      0.000      0.817  26NM
## 26      0.003      0.819  26NM
## 27      0.001      0.783  21NM
## 28      0.000      0.792  26NM
## 29      0.000      0.783  26NM
## 30      0.000      0.758  26NM
## 31      0.000      0.745  20NM
## 32      0.000      0.741  21NM
## 33      0.000      0.672  26NM
## 34      0.000      0.638  27NM
## 35      0.000      0.573  28NM
## 36      0.000      0.527  28NM
## 37      0.000      0.520  28NM
## 38      0.000      0.514  26NM
## 39      0.000      0.447  28NM
## 40      0.000      0.386  20NM
## 41      0.000      0.338  18TX
## 42      0.050      0.244  28NM
## 43      0.000      0.181  15TX
## 44      0.000      0.135  19TX
## 45      0.000      0.125  16TX
## 46      0.908      0.088  28NM
## 47      0.054      0.081  19TX
## 48      0.000      0.074  19TX
## 49      0.973      0.026  46CH
## How many carinata-sublineata hybrids? 
car_sub_hyb <- ci %>%
  rownames_to_column('individual') %>%
  filter(carinata_L >.01  & sublineata_L > .01 & elongata_L < .01)
car_sub_hyb
##    individual sampID elongata_L elongata_H carinata_L carinata_H
## 1         223    F78      0.005      0.044      0.036      0.110
## 2         238    F92      0.000      0.001      0.419      0.541
## 3         240    F94      0.000      0.054      0.099      0.202
## 4         241    F95      0.000      0.001      0.054      0.126
## 5         242    F96      0.000      0.015      0.269      0.384
## 6         245    G11      0.000      0.001      0.073      0.156
## 7         253    G19      0.000      0.002      0.301      0.425
## 8         271    G35      0.000      0.001      0.053      0.143
## 9         274    G38      0.000      0.001      0.554      0.673
## 10        277    G40      0.000      0.001      0.027      0.087
## 11        289    G52      0.000      0.001      0.207      0.304
## 12        297     G6      0.000      0.001      0.053      0.114
## 13        301    G63      0.000      0.009      0.121      0.209
## 14        316    G78      0.000      0.001      0.827      0.918
## 15        320    G81      0.000      0.001      0.011      0.056
## 16        322    G83      0.000      0.001      0.193      0.329
## 17        329     G9      0.000      0.001      0.163      0.256
## 18        334    H10      0.000      0.048      0.626      0.755
## 19        336    H12      0.000      0.001      0.195      0.294
## 20        343    H19      0.000      0.001      0.047      0.106
## 21        344     H2      0.000      0.001      0.817      0.914
## 22        346    H21      0.000      0.001      0.140      0.227
## 23        347    H22      0.000      0.002      0.427      0.545
## 24        374    H47      0.000      0.001      0.876      0.974
## 25        383    H55      0.000      0.001      0.815      0.911
## 26        392    H64      0.000      0.001      0.604      0.721
## 27        395    H67      0.000      0.001      0.367      0.488
## 28        396    H68      0.000      0.001      0.413      0.533
## 29        400    H71      0.000      0.016      0.099      0.188
## 30        403     H9      0.000      0.001      0.492      0.613
##    carinulata_L carinulata_H sublineata_L sublineata_H elongata carinata
## 1         0.000        0.001        0.869        0.935    0.025    0.071
## 2         0.000        0.001        0.459        0.581    0.000    0.480
## 3         0.000        0.019        0.768        0.865    0.031    0.148
## 4         0.000        0.001        0.874        0.946    0.000    0.087
## 5         0.000        0.001        0.615        0.729    0.002    0.326
## 6         0.000        0.001        0.843        0.927    0.000    0.112
## 7         0.000        0.001        0.575        0.699    0.000    0.362
## 8         0.000        0.001        0.857        0.947    0.000    0.094
## 9         0.000        0.001        0.327        0.446    0.000    0.614
## 10        0.000        0.001        0.913        0.973    0.000    0.055
## 11        0.000        0.001        0.696        0.793    0.000    0.254
## 12        0.000        0.001        0.886        0.947    0.000    0.082
## 13        0.000        0.001        0.790        0.877    0.001    0.164
## 14        0.000        0.001        0.082        0.172    0.000    0.875
## 15        0.000        0.001        0.944        0.989    0.000    0.032
## 16        0.000        0.001        0.671        0.806    0.000    0.259
## 17        0.000        0.001        0.744        0.837    0.000    0.208
## 18        0.027        0.073        0.183        0.307    0.014    0.692
## 19        0.000        0.001        0.706        0.805    0.000    0.242
## 20        0.000        0.001        0.893        0.953    0.000    0.075
## 21        0.033        0.076        0.032        0.130    0.000    0.866
## 22        0.000        0.001        0.773        0.860    0.000    0.183
## 23        0.000        0.001        0.454        0.572    0.000    0.486
## 24        0.000        0.001        0.026        0.123    0.000    0.926
## 25        0.000        0.001        0.088        0.185    0.000    0.865
## 26        0.000        0.001        0.279        0.396    0.000    0.662
## 27        0.000        0.001        0.512        0.633    0.000    0.427
## 28        0.000        0.001        0.467        0.587    0.000    0.473
## 29        0.000        0.001        0.810        0.898    0.002    0.142
## 30        0.000        0.001        0.387        0.507    0.000    0.553
##    carinulata sublineata popID
## 1       0.000      0.904  27NM
## 2       0.000      0.520  28NM
## 3       0.003      0.819  26NM
## 4       0.000      0.913  26NM
## 5       0.000      0.672  26NM
## 6       0.000      0.888  26NM
## 7       0.000      0.638  27NM
## 8       0.000      0.905  20NM
## 9       0.000      0.386  20NM
## 10      0.000      0.945  21NM
## 11      0.000      0.745  20NM
## 12      0.000      0.918  28NM
## 13      0.000      0.835  20NM
## 14      0.000      0.125  16TX
## 15      0.000      0.968  27NM
## 16      0.000      0.741  21NM
## 17      0.000      0.792  26NM
## 18      0.050      0.244  28NM
## 19      0.000      0.758  26NM
## 20      0.000      0.925  27NM
## 21      0.054      0.081  19TX
## 22      0.000      0.817  26NM
## 23      0.000      0.514  26NM
## 24      0.000      0.074  19TX
## 25      0.000      0.135  19TX
## 26      0.000      0.338  18TX
## 27      0.000      0.573  28NM
## 28      0.000      0.527  28NM
## 29      0.000      0.856  26NM
## 30      0.000      0.447  28NM
ci %>%
  rownames_to_column('individual') %>%
  filter(carinata_L >.01  & sublineata_L > .01 & elongata_L < .01) %>%
  count()
## # A tibble: 1 x 1
##       n
##   <int>
## 1    30
mean(car_sub_hyb$sublineata)
## [1] 0.6334333
## How many carinata-elongata hybrids? 
car_elong_hyb <- ci %>%
  rownames_to_column('individual') %>%
  filter(carinata_L >.01 & elongata_L> .01 & sublineata_L < .01)

ci %>%
  rownames_to_column('individual') %>%
  filter(carinata_L >.01 & elongata_L> .01 & sublineata_L < .01) %>%
  count()
## # A tibble: 1 x 1
##       n
##   <int>
## 1     3
ci %>%
  rownames_to_column('individual') %>%
  filter(carinata_L >.01 & elongata_L> .01 & sublineata_L < .01) %>%
  summarize_at(vars(carinata_L, elongata_L), funs(mean))
##   carinata_L elongata_L
## 1  0.7993333  0.1346667
## How many elong-sublineata hybrids? 
elong_sub_hyb <- ci %>%
  rownames_to_column('individual') %>%
  filter(carinata_L < .01  & sublineata_L > .01 & elongata_L > .01)
elong_sub_hyb
##   individual sampID elongata_L elongata_H carinata_L carinata_H
## 1        244    G10      0.055      0.091          0      0.001
## 2        246    G12      0.018      0.043          0      0.001
## 3        256    G21      0.020      0.048          0      0.001
## 4        257    G22      0.034      0.068          0      0.001
## 5        263    G28      0.027      0.057          0      0.001
## 6        275    G39      0.028      0.070          0      0.023
## 7        288    G50      0.065      0.105          0      0.001
## 8        349    H24      0.057      0.118          0      0.041
## 9        351    H26      0.185      0.248          0      0.001
##   carinulata_L carinulata_H sublineata_L sublineata_H elongata carinata
## 1            0        0.001        0.909        0.945    0.072    0.000
## 2            0        0.001        0.957        0.982    0.029    0.000
## 3            0        0.001        0.952        0.980    0.033    0.000
## 4            0        0.001        0.932        0.966    0.050    0.000
## 5            0        0.001        0.943        0.973    0.041    0.000
## 6            0        0.002        0.924        0.969    0.048    0.003
## 7            0        0.001        0.895        0.935    0.084    0.000
## 8            0        0.010        0.869        0.937    0.086    0.006
## 9            0        0.007        0.751        0.814    0.216    0.000
##   carinulata sublineata popID
## 1      0.000      0.927  26NM
## 2      0.000      0.970  26NM
## 3      0.000      0.967  27NM
## 4      0.000      0.950  27NM
## 5      0.000      0.959  27NM
## 6      0.000      0.949  21NM
## 7      0.000      0.916  20NM
## 8      0.001      0.907  26NM
## 9      0.001      0.783  21NM
mean(elong_sub_hyb$sublineata)
## [1] 0.9253333
### this is probably better represented as a simplex (triangle)
pCS <- ggplot(car_sub_hyb) +
  geom_histogram(aes(carinata), 
                 alpha = .5, fill = legend[which(legend$spp=="carinata"), "cbbPalette"], stat = "bin", binwidth = .05) +
  geom_histogram(aes(sublineata), 
                 alpha = .5, fill = legend[which(legend$spp=="sublineata"), "cbbPalette"], stat = "bin", binwidth = .05) +
  ylim(c(0,8)) +
  scale_x_continuous(name= expression( ~italic("D. carinata")~ "X"  ~italic("D. sublineata")~ "q-values")) +
  theme_bw()

pCE <-ggplot(car_elong_hyb) +
  geom_histogram(aes(carinata), 
                 alpha = .5, fill = legend[which(legend$spp=="carinata"), "cbbPalette"], stat = "bin", binwidth = .05) +
  geom_histogram(aes(elongata), 
                 alpha = .5, fill = legend[which(legend$spp=="elongata"), "cbbPalette"], stat = "bin", binwidth = .05) +
  ylim(c(0,8)) +
    scale_x_continuous(name= expression( ~italic("D. elongata")~ "X"  ~italic(" D. carinata")~ "q-values")) +
  theme_bw()
pCE

pES <-ggplot(elong_sub_hyb) +
  geom_histogram(aes(elongata), 
                 alpha = .5,fill = legend[which(legend$spp=="elongata"), "cbbPalette"], stat = "bin", binwidth = .05) +
  geom_histogram(aes(sublineata), 
                 alpha = .5, fill = legend[which(legend$spp=="sublineata"), "cbbPalette"], stat = "bin", binwidth = .05) +
  ylim(c(0,8)) +
      scale_x_continuous(name= expression( ~italic("D. elongata")~ "X"  ~italic(" D. sublineata")~ "q-values")) +
  theme_bw()
  
cowplot::plot_grid(pCS, pCE, pES, nrow = 1, labels = c('A','B','C'))

ggsave("hybrid_distributions.jpg", dpi = 300, height = 4, width = 10, units = "in")
## Pull pure parental species 
pure_parentals <- ci %>%
  filter(carinata_L > .995 | elongata_L > .995 | 
           sublineata_L > .995 | carinulata_L > .995) %>% 
  merge(popmap)

pure_parentals$assignment <- colnames(pure_parentals[,c('elongata', 'carinata', 'carinulata', 'sublineata')])[max.col(pure_parentals[,c('elongata', 'carinata', 'carinulata', 'sublineata')])]

table(pure_parentals$assignment)
## 
##   carinata carinulata   elongata sublineata 
##         40        172         86        129
pure_parentals_popmap <- pure_parentals[,c('sampID', 'assignment')]
write.table(pure_parentals_popmap, "../info/pure_parentals_popmap.tsv", col.names = F, quote = F, row.names = F, sep = "\t")

Substructure

Population structure within D. carinulata

sfiles <- list.files(path="~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/substructure/carinulata/structure_analysis/Results/", 
  pattern=glob2rx("outfile_*f"),full.names=TRUE)

carinu_slist <- readQ(sfiles,filetype="structure", 
               indlabfromfile = TRUE, 
               readci = TRUE)

sr1 <- summariseQ(tabulateQ(carinu_slist))
p <- evannoMethodStructure(data=sr1,exportplot=F,returnplot=T,returndata=F,basesize=12,linesize=0.7)
grid.arrange(p)

evannoMethodStructure(data=sr1,
                  exportplot=T,
                  exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/substructure/carinulata/structure_analysis/plots/",
                outputfilename = "carinulata_deltaK",
                returndata=F,
                height = 10, width = 9)

popmap <- left_join(data.frame(sampID = rownames(carinu_slist[[1]])), 
                    masterpopmap)
## Joining, by = "sampID"
## Warning: Column `sampID` joining factor and character vector, coercing into
## character vector
popID <- data.frame(popID = popmap$popID)
popID <- data.frame(lapply(popID, as.character), stringsAsFactors=FALSE)
sapply(popID, is.character)
## popID 
##  TRUE
pop_order <- sample_meta.dat[,c("popID", "Order")]
pop_order <- semi_join(pop_order, popID) %>%
  arrange(Order)
## Joining, by = "popID"
pop_order <- pop_order[,1]

legend_colors
##   cbbPalette human_colors            spp
## 1    #56B4E9         blue       carinata
## 2    #E69F00       orange       elongata
## 3    #009E73        green     sublineata
## 4    #F0E442       yellow     carinulata
## 5    #0072B2    dark blue   elongata_sub
## 6    #D55E00          red carinulata_sub
## 7    #CC79A7         pink          other
carinu_legend <- legend_colors[c(4,6,7),]
carinu_cbbPalette <- carinu_legend[,'cbbPalette']

plotQ(alignK(carinu_slist[c(21:30)]),
            imgoutput="join",
                  exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/substructure/carinulata/structure_analysis/plots/",
  outputfilename =  "Joined-K2",  
  exportplot=T,
  showyaxis=T,
  showsp = F,
  clustercol=carinu_cbbPalette,
  subsetgrp = pop_order,
  height = .1,
  ordergrp = T,
  grplab = popID,
  linepos = 1,
  divtype = 1,
  grplabangle=45,
  grplabpos = .8,
  grplabspacer = 0,
  grplabheight=70,
  width=100,
  showtitle=T,
  grplabsize = 4,
  titlelab="D. carinulata Population Structure, K=2",
  titlesize = 20)
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/substructure/carinulata/structure_analysis/plots/Joined-K2.png exported.
plotQ(alignK(carinu_slist[c(31:40)]),
            imgoutput="join",
                  exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/substructure/carinulata/structure_analysis/plots/",
  outputfilename =  "Joined-K3",  
  exportplot=T,
  showyaxis=T,
  showsp = F,
  clustercol=carinu_cbbPalette,
  subsetgrp = pop_order,
  height = .1,
  ordergrp = T,
  grplab = popID,
  linepos = 1,
  divtype = 1,
  grplabangle=45,
  grplabpos = .8,
  grplabspacer = 0,
  grplabheight=70,
  width=100,
  showtitle=T,
  grplabsize = 4,
  titlelab="D. carinulata Population Structure, K=3",
  titlesize = 20)
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/substructure/carinulata/structure_analysis/plots/Joined-K3.png exported.
k4 <- plotQ(alignK(carinu_slist[c(41:50)]),
            imgoutput="join",
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            clustercol=cbbPalette,
            subsetgrp = pop_order,
            ordergrp = T,
            grplab = popID,
            grplabangle=-90)
grid.arrange(k4$plot[[1]])

k5 <- plotQ(alignK(carinu_slist[c(51:60)]),
            imgoutput="join",
            subsetgrp = pop_order,
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            clustercol=cbbPalette,
            ordergrp = T,
            grplab = popID,
            grplabangle=-90)
grid.arrange(k5$plot[[1]])

k6 <- plotQ(alignK(carinu_slist[c(61:70)]),
            imgoutput="join",
            subsetgrp = pop_order,
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            clustercol=cbbPalette,
            ordergrp = T,
            grplab = popID,
            grplabangle=-90)
grid.arrange(k6$plot[[1]])

k7 <- plotQ(alignK(carinu_slist[c(71:80)]),
            imgoutput="join",
            subsetgrp = pop_order,
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            clustercol=cbbPalette,
            ordergrp = T,
            grplab = popID,
            grplabangle=-90)
grid.arrange(k7$plot[[1]])

plotQ(carinu_slist[31],
            exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/substructure/carinulata/structure_analysis/plots/",
        outputfilename =  "MainTextFigure_carinuK3",  
  exportplot=T,
  showyaxis=T,
  showsp = F,
  clustercol=carinu_cbbPalette,
  subsetgrp = pop_order,
  ordergrp = T,
  grplab = popID,
  linepos = 1,
  linesize=0.8,
  pointsize = 5,
  divtype = 1,
  divsize = 1,
  grplabangle= 90,
  grplabpos = .9,
  grplabspacer = 0,
  grplabheight=40,
  grplabsize = 25,
  height = .05,
  width=100,
  showlegend = T, legendkeysize=30,legendtextsize=30, legendpos="left", legendlab= c("D. carinulata Fukang Ecotype", "D. carinulata Chilik Ecotype", "Other"),
  basesize=30)
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/substructure/carinulata/structure_analysis/plots/MainTextFigure_carinuK3.png exported.

Population structure within D. elongata

sfiles <- list.files(path="~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/substructure/elongata/structure_analysis/Results/", 
  pattern="outfile_*",full.names=TRUE)

elong_slist <- readQ(sfiles,filetype="structure", 
               indlabfromfile = TRUE, 
               readci = TRUE)

popmap <- left_join(data.frame(sampID = rownames(elong_slist[[1]])), 
                    masterpopmap)
## Joining, by = "sampID"
## Warning: Column `sampID` joining factor and character vector, coercing into
## character vector
popID <- data.frame(popID = popmap$popID)
popID <- data.frame(lapply(popID, as.character), stringsAsFactors=FALSE)
sapply(popID, is.character)
## popID 
##  TRUE
pop_order <- sample_meta.dat[,c("popID", "Order")]
pop_order <- semi_join(pop_order, popID) %>%
  arrange(Order)
## Joining, by = "popID"
pop_order <- pop_order[,1]

legend_colors
##   cbbPalette human_colors            spp
## 1    #56B4E9         blue       carinata
## 2    #E69F00       orange       elongata
## 3    #009E73        green     sublineata
## 4    #F0E442       yellow     carinulata
## 5    #0072B2    dark blue   elongata_sub
## 6    #D55E00          red carinulata_sub
## 7    #CC79A7         pink          other
elong_legend <- legend_colors[c(2,5,7),]
elong_cbbPalette <- elong_legend[,'cbbPalette']
sr1 <- summariseQ(tabulateQ(elong_slist))

evannoMethodStructure(data=sr1,
                  exportplot=T,
                  exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/substructure/elongata/structure_analysis/plots/",
                outputfilename = "elongata_deltaK",
                returndata=F,
                height = 10, width = 9)

k2 <- plotQ(alignK(elong_slist[c(21:30)]),
            imgoutput="join",
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            clustercol=cbbPalette,
            subsetgrp = pop_order,
            ordergrp = T,
            grplab = popID,
            linepos = 1,
            grplabangle=-45,
            grplabpos = 0, 
            grplabheight=20)
grid.arrange(k2$plot[[1]])

k3 <- plotQ(alignK(elong_slist[c(31:40)]),
            imgoutput="join",
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            clustercol=cbbPalette,
            ordergrp = T,
            grplab = popID,
            grplabangle=-90)
grid.arrange(k3$plot[[1]])

k4 <- plotQ(alignK(elong_slist[c(41:50)]),
            imgoutput="join",
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            clustercol=cbbPalette,
            ordergrp = T,
            grplab = popID,
            grplabangle=-90)
grid.arrange(k4$plot[[1]])

k5 <- plotQ(alignK(elong_slist[c(51:60)]),
            imgoutput="join",
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            clustercol=cbbPalette,
            ordergrp = T,
            grplab = popID,
            grplabangle=-90)
grid.arrange(k5$plot[[1]])

k6 <- plotQ(alignK(elong_slist[c(61:70)]),
            imgoutput="join",
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            clustercol=cbbPalette,
            ordergrp = T,
            grplab = popID,
            grplabangle=-90)
grid.arrange(k6$plot[[1]])

k7 <- plotQ(alignK(elong_slist[c(71:80)]),
            imgoutput="join",
            returnplot=T,exportplot=F,quiet=T,basesize=11,
            clustercol=cbbPalette,
            ordergrp = T,
            grplab = popID,
            grplabangle=-90)
grid.arrange(k7$plot[[1]])

plotQ(elong_slist[32],
            exportpath = "~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/substructure/elongata/structure_analysis/plots/",
        outputfilename =  "MainTextFigure_elongataK3",  
  exportplot=T,
  showyaxis=T,
  showsp = F,
  clustercol=elong_cbbPalette,
  subsetgrp = pop_order,
  ordergrp = T,
  grplab = popID,
  linepos = 1,
  linesize=0.8,
  pointsize = 5,
  divtype = 1,
  divsize = 1,
  grplabangle= 90,
  grplabpos = .9,
  grplabspacer = 0,
  grplabheight=40,
  grplabsize = 25,
  height = .05,
  width=100,
  showlegend = T, legendkeysize=30,legendtextsize=30, legendpos="left", legendlab= c("D. elongata Mainland Ecotype", "D. elongata Crete Ecotype", "Other"),
  basesize=30)
## Drawing plot ...
## ~/Code/diorhabda/StahlkeBitume_heirarchical_str/Git_Repo/substructure/elongata/structure_analysis/plots/MainTextFigure_elongataK3.png exported.